Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Add aria-hidden support #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ public function wildcard($tag)
{
$icon = $this->params->get('icon');
$class = $this->params->get('class');
$ariaHidden = $this->params->get('aria-hidden', 'false');

if (Str::contains($tag, ':')) {
[$tag, $icon] = explode(':', $tag);
}

return $this->output($tag, "{$icon}.svg", compact('class'));
return $this->output($tag, "{$icon}.svg", compact('class', 'ariaHidden'));
}

protected function output($type, $icon, $attributes = [])
Expand All @@ -39,7 +40,8 @@ protected function output($type, $icon, $attributes = [])

$attr = '';

foreach ($attributes as $key => $value) {
foreach ($attributes as $key => (string) $value) {
$key = Str::kebab($key);
$attr .= " {$key}=\"{$value}\"";
}

Expand Down