Skip to content

Conversation

@tito10047
Copy link

Q A
Bug fix? no
New feature? yes
Issues Fix #2276
License MIT

Add ability to modity InputProps inside EventListener

#[AsEventListener(priority: 100)]
class UxIconListener
{
    public function __invoke(PreCreateForRenderEvent $event): void
    {
        if ('ux:icon' !== strtolower($event->getName())) {
            return;
        }
        $attributes = $event->getInputProps();

        if ($attributes['name']!=="my-global-icon"){
            return;
        }
        
        $attributes["class"] = "icon view";
        $attributes["title"]= "this item is public";
        
        $event->setInputProps($attributes);

    }
}

@smnandre
Copy link
Member

This event is not designed for this usage, but to return HTML and bypass the system.

You can achieve similar goal by:

@tito10047 tito10047 closed this Oct 16, 2024
@tito10047 tito10047 deleted the ux_icon_listener branch November 11, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants