Drop #attributes default from form_builder()

Created on 27 January 2011, over 13 years ago
Updated 1 September 2024, 7 days ago

form_builder() applies the following defaults to all form elements:

  // Assign basic defaults common for all form elements.
  $element += array(
    '#required' => FALSE,
    '#attributes' => array(),
    '#title_display' => 'before',
  );

The default for #attributes is a wonky serious and weird problem, when using trying to render themeable elements within the context of a form, like this:

  $form['links']['#theme'] = 'links';
  $form['links']['#links']['foo'] = array(...);

Due to form_builder()'s default for #attributes, theme_links() no longer applies the default theme variable value for 'attributes', as defined in drupal_common_theme() for theme_links().

πŸ› Bug report
Status

Closed: outdated

Version

11.0 πŸ”₯

Component
FormΒ  β†’

Last updated less than a minute ago

Created by

πŸ‡©πŸ‡ͺGermany sun Karlsruhe

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    8 years it was asked if this is still relevant. There hasn't been a reply which suggests this is outdated. So, one last check on that.

    Is this still relevant for Drupal 10+?

    Since we need more information to move forward with this issue, I am setting the status to Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

  • Status changed to Closed: outdated 7 days ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    It has been 5 months and there has been no confirmation that this is still a problem. Therefore closing.

Production build 0.71.5 2024