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.
Form elements are not added to the subform if #attributes[name] is explicitly set, because in that case, the explicit setting overrides the value in #name. You end up with the original name on the element instead of the subform-nested name. This problem arose in a multi-select field, which had #attributes[name] explicitly set.
Comment | File | Size | Author |
---|---|---|---|
#2 | subform-attributes-name-1187256-2.patch | 997 bytes | cwgordon7 |
#1 | subform-attributes-name-1187256-1.patch | 499 bytes | cwgordon7 |
Comments
Comment #1
cwgordon7 CreditAttribution: cwgordon7 commentedThis patch fixes the problem.
Comment #2
cwgordon7 CreditAttribution: cwgordon7 commentedSorry, this patch works better.
Comment #3
casey CreditAttribution: casey commentedThanks!
Comment #4
casey CreditAttribution: casey commentedActually we should only overwrite the #attributes[name]. If we overwrite #name theme_form_element will set classes prefixed with subform name. CSS and Javascript might however depend on those classes.
Hopefully this won't introduce other problems.