Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form] Passing view attributes to choice options #6717

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

Closed
vmattila opened this issue Jan 12, 2013 · 1 comment
Closed

[Form] Passing view attributes to choice options #6717

vmattila opened this issue Jan 12, 2013 · 1 comment

Comments

@vmattila
Copy link

It would be useful if view attributes could be passed to individual choice field options in a similar way as attr for most field types. Currently it seems not to be possible without duplicating both ChoiceList PHP class and duplicating both choice_widget and widget_choice_options template blocks.

If the core form module supported (arbitrary) attrs in choice options, it would allow easy extension of the core choice field type for custom types. Custom data could be passed to the template, allowing HTML like:

<select name="search_engine_selection">
    <option value="google" data-url="google_logo.gif">Google</option>
    <option value="bing" data-url="bing_logo.gif">Bing</option>
</select>

In my example, data-url would have been passed as an attribute to each option.

@stof
Copy link
Member

stof commented Jan 12, 2013

Closing as duplicate of #3836

@stof stof closed this as completed Jan 12, 2013
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

No branches or pull requests

2 participants