-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Implemented attributes for choices #10309
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
Conversation
it should be possible to build the attribute with a callable instead of having to pass the attributes for each choice directly IMO |
I added this feature. It was also mentionned in this comment #7510 (comment) |
Will this be available soon? |
@fabpot Any news about this?? |
👍 just needed this :) |
👍 |
👍 |
2 similar comments
+1 |
+1 |
@webmozart can you merge this PR? |
+1 |
+1 for this, would be helpful :) |
I think it also relates to #9289. 👍 Any chance to support this PR? |
👍 |
Replaced by #12148. |
Use cases
Add attributes to choices like it's possible with any other element for example to add microdata attributes to use in select2 templates or disable choices.
Usage
There are a few ways to apply attributes to choices:
By specifying the choices_attr option
Note: It works only when using
choices
. See below for when usingchoice_list
.As an array
As a callable
By passing the attributes to the choice lists
Edit : It is related to the following issues
#7510
#9694
#3836