-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
[Autocomplete] (using without form) How to pass extra_options to stimulus controller ? #2368
Comments
Hi @matthieumastadenis , I believe the second paragraph about custom Autocomplete has been missplaced. You can pass options to a custom Autocompleter (in the meaning "not for an entity, or not with the same implementation than the one we use).. but to use extra_options it must be generated with the form system (where we generate the url / checksum). Or ... you can look at the ChecksumCalculator class to see how it's done today. But as you will see this class is marked internal, meaning it can change at any moment (passing the "extra_options" is supported, but the way it works right now must stay internal to be able to change/improve it) |
Thanks, indeed I saw the ChecksumCalculator class and the @internal tag so I preferred to ask. For the moment I found a workaround by using a child component in which I can now use a dedicated form. But I eventually may have a similar issue in the future, and I think it would be better to avoid reimplementing ChecksumCalculator myself (especially if this is expected to change in the future). In the ideal scenario it would be great to have a twig function ( |
Could i ask you what would be your use case here ? See what would be possible ? |
Hello,
I'm using the autocomplete component outside of a form and I need to use
extra_options
. I followed the documentation and implemented the following class:However, I cannot find how to properly pass my extra_options to the stimulus controller from twig. Unless I'm mistaken, I think the "Manually using stimulus controller" section of the documentation lacks some precision about that.
I first tried this:
...which resulted in the following error:
Then I tried this (with a custom base64_encode filter):
...which also gave me an error:
So, how can I simply pass my extra options? Do I have to manually create and include the checksum myself (if so, how exactly please?) or is there a simpler way to achieve this?
Thanks
The text was updated successfully, but these errors were encountered: