From e0918ebc0a82f9d5b326cf56e60c7f8e47f6496b Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 7 Oct 2024 16:22:42 +0200 Subject: [PATCH] Icon: Use fully qualified names as-is --- src/Widget/Icon.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Widget/Icon.php b/src/Widget/Icon.php index 5c2617f0..195c9fe7 100644 --- a/src/Widget/Icon.php +++ b/src/Widget/Icon.php @@ -4,6 +4,7 @@ use ipl\Html\Attributes; use ipl\Html\BaseHtmlElement; +use ipl\Stdlib\Str; /** * Icon element @@ -30,9 +31,13 @@ class Icon extends BaseHtmlElement */ public function __construct(string $name, $attributes = null) { + if (! Str::startsWith($name, 'fa-')) { + $name = "fa-$name"; + } + $this ->getAttributes() - ->add('class', ['icon', "fa-$name"]) + ->add('class', ['icon', $name]) ->add($attributes); }