Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.Form elements of type #markup (the default type) are allowed to have a title and a description, according to http://api.drupal.org/api/HEAD/file/developer/topics/forms_api_reference.... But these attributes are not outputted by theme_markup(), because it does not have the standard call to theme('form_element').
Attached patch fixes this.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | theme_markup_1.patch | 655 bytes | Jaza |
| #1 | theme_markup_0.patch | 582 bytes | Jaza |
| theme_markup.patch | 599 bytes | Jaza |
Comments
Comment #1
Jaza commentedRemoved #id parameter from call to theme('form_element'), as this doesn't apply for #markup.
Comment #2
Jaza commentedUpdated to only call theme('form_element') if #title or #description are set, because calling it for existing #markup elements in core seems to wreck the layout of some pages (e.g. admin/modules).
Comment #3
killes@www.drop.org commentedThis needs a review by some form API person.
Comment #4
Jaza commentedI have talked to chx, and it has been determined that markup elements should never be passed through theme('form_element'), as this wraps the element in a
<div class="form-item">, which should never happen for markup.The conclusion is that when a title and/or a description is needed, use type item instead of type markup. Title and description should no longer be allowed for elements of type markup. I couldn't see anywhere in the code that the rules of allowed attributes for form element types is defined, so it looks like it's just the docs on api.drupal.org that need to be updated.
Comment #5
Jaza commentedComment #6
xano