-
-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LiveComponent] Add 'live_action' twig function #1946
Conversation
Hi @pierredup ! I like the idea very much (in term of DX), but internally i think we should leverage the StimulusAttribute already present in the Stimulus-Bundle ... https://symfony.com/bundles/StimulusBundle/current/index.html#stimulus-action ... what do you thinkl ? |
Depending on your answer on the previous question, this comment could be useless ;) We'd need to specify the trigger, as even if an action is often trigger by the "default event" on the DOM element it's registerered on, but this can be more specific / diverse Examples here: https://stimulus.hotwired.dev/reference/actions#keyboardevent-filter |
I did initially start to go down this route, but then noticed the StimulusBundle is not a direct dependency of the LiveComponent, so didn't want to use classes that's not guaranteed to be available. Will then just add the StimulusBundle as a dependency to LiveComponent
Cool, yeah that makes sense, will add it to the function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this - you're totally right, the syntax is hard to remember!
e5e715d
to
2417af1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @pierredup !
Just two last tiny details and good!
2c7e330
to
b35807b
Compare
Thanks for your work on this new feature! |
Adds a new
live_action
twig function.This helps with creating the proper attributes to call a live action. I can never remember the syntax and need to look up the docs every time to add a live action. This will make the process much easier.
Example Usage:
Additional Parameters:
Adding Modifiers:
TODO: