Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently there is no way for adding #attributes for form select element options without a custom theme and doing it in the theme layer. More complex javascript front-end implementations require setting data attributes for form select options.
Comment | File | Size | Author |
---|---|---|---|
#19 | 2772629-19.patch | 988 bytes | _utsavsharma |
#19 | interdiff-2772629_18-19.txt | 988 bytes | _utsavsharma |
#18 | allow_setting_attributes_form_select_options-2772629-18.patch | 1.84 KB | Medha Kumari |
#2 | allow_setting_attributes_form_select_options-2772629-2.patch | 2.88 KB | aleksijohansson |
Comments
Comment #2
aleksijohansson CreditAttribution: aleksijohansson at Wunder commentedI understand that this is not optimal way for implementing this and there is already a better issue for separating select type to option and optgroup here, but this is what we needed for a project.
Comment #3
stefan.r CreditAttribution: stefan.r commentedThis will probably need to be fixed in 8.x first, and can then be backported to 7.x.
Comment #17
smustgrave CreditAttribution: smustgrave at Mobomo commentedComment #18
Medha KumariRerolled the patch #2 in Drupal 10.1.x.
Comment #19
_utsavsharma CreditAttribution: _utsavsharma at OpenSense Labs commentedfrom taxonomy.module removed function taxonomy_get_children
from form.inc removed else if condition
because the attributes defined there that were failing the custom command and the function were not returning any value.
Comment #21
camchandler98 CreditAttribution: camchandler98 at ITT Digital commentedRan the previously failing test for #19 locally and it passed, reran the tests here and they passed this time .
Comment #22
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis needs a heavy issue summary update.
Also was previously tagged for test which still need to happen.