Closed javiereguiluz closed 1 week ago
There is no UX:icon component, and i'm not sure we ever documented it (this would be a mistake).
The code you use worked previously but was a side effect caused by a bad implémentation made by.... me.
You can have the same result using the ux_icon() Twig fonction, it should be exactly the same for you.
Note: I will make a patch as soon as possible to either keep some retro-comparibility or at least improve exception message. I just need one hour of "free time" 🫠
Simon, thanks a lot for reviewing this. I'd say we could close this as "won't fix". My code worked "by chance", so the break wasn't really a break. I applied your suggestion and now use the ux_icon()
function.
Everything works perfectly now. So, I don't think we need to add support for the other obscure notation. Thanks a lot!
Thank for the update @javiereguiluz .. and for all your help and contributions on this repo ❤️
I have a custom
Icon
Twig component that basically does this:In UX Icon 2.20.0 and earlier versions, it works. Starting from 2.21.0, it fails with this error:
If I set it to:
I see a similar error:
I also tried
{% component 'twig:UX:Icon'
,{% component 'Twig:UX:Icon'
, etc. with no effect.Full stack trace:
In case you are wondering why I use this instead of just using the normal Icon Twig component.
Some of my icons have
class
attributes. If I used this:If the user defines
class
explicitly, then the icon is rendered with that customclass
and overrides the originalclass
. That's fine.But, if the user doesn't define the
class
prop, then it's like<twig:ux:icon ... class="{{ false }}" />
which in practice removes theclass
attribute originally defined by the icon. That's wrong.So, my component has code like this: