Skip to content

Commit e0918eb

Browse files
committed
Icon: Use fully qualified names as-is
1 parent 09afc04 commit e0918eb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Widget/Icon.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use ipl\Html\Attributes;
66
use ipl\Html\BaseHtmlElement;
7+
use ipl\Stdlib\Str;
78

89
/**
910
* Icon element
@@ -30,9 +31,13 @@ class Icon extends BaseHtmlElement
3031
*/
3132
public function __construct(string $name, $attributes = null)
3233
{
34+
if (! Str::startsWith($name, 'fa-')) {
35+
$name = "fa-$name";
36+
}
37+
3338
$this
3439
->getAttributes()
35-
->add('class', ['icon', "fa-$name"])
40+
->add('class', ['icon', $name])
3641
->add($attributes);
3742
}
3843

0 commit comments

Comments
 (0)