After I changed my admin theme to bootstrap, my forms #states stopped working. When I looked into it I found that ID selector was not added to the form element "item". I have used form type "item" to wrap around some form elements and to display/hide those elements based on a radio button. So the #markup is empty.
bootstrap_form_element in form-element.fun.php does not add wrapper id if #markup is empty.
// Add wrapper ID for 'item' type.
if ($type && $type === 'item' && !empty($element['#markup']) && !empty($element['#id'])) {
$wrapper_attributes['id'] = $element['#id'];
}
I checked in includes/forms.inc, there it checks only for isset before adding ID.
// Add element #id for #type 'item'.
if (isset($element['#markup']) && !empty($element['#id'])) {
$attributes['id'] = $element['#id'];
}
Is there any reason why we check if markup is empty before adding wrapper ID? Can we patch it with isset?
Comments
Comment #2
markhalliwellPlease feel free to create a patch. I will gladly commit this change.
Comment #3
zuhair_akAdded the patch. Thanks for the reply.
Comment #4
markhalliwellSorry this took so long. For future reference, you should set the status of an issue to "Needs review" when there's a patch on it. Otherwise, its priority is bumped for those that have that status and why I'm just now getting around to the "Active" backlog.
Comment #6
zuhair_akI had forgotten to change the status to "Need Review". Thanks Mark for noticing and committing it.