API page: http://api.drupal.org/api/drupal/core%21includes%21form.inc/function/the...

The function contains the following code.

  $element = &$variables['element'];
  // This is also used in the installer, pre-database setup.
  $t = get_t();

$t is never used from the theme function.

That code is remains of Drupal 6 code, where the variable was used from the following code.

    if (!empty($element['#id'])) {
      $output .= ' <label for="' . $element['#id'] . '">' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
    }
    else {
      $output .= ' <label>' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
    }

The code has been changed since Drupal 7, but the variable is still initialized.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

apaderno’s picture

Status: Active » Needs review
FileSize
524 bytes

The function that handles the form element label is theme_form_element_label(), which is correctly using get_t().

swentel’s picture

Status: Needs review » Reviewed & tested by the community
catch’s picture

Status: Reviewed & tested by the community » Fixed

Thanks! Committed/pushed to 8.x.

apaderno’s picture

Title: theme_form_element() initialize a variable that is never used » Remove file_attach_load() from file_field_update()
Version: 8.x-dev » 7.x-dev
Category: bug » task
Status: Fixed » Needs review
Issue tags: -Novice +Needs backport to D7
FileSize
496 bytes
apaderno’s picture

Title: Remove file_attach_load() from file_field_update() » theme_form_element() initialize a variable that is never used

I didn't notice the title was changed.

swentel’s picture

Status: Needs review » Reviewed & tested by the community

Good to go.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed

Automatically closed -- issue fixed for 2 weeks with no activity.