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 .= ' ' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "\n";
    }
    else {
      $output .= ' ' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "\n";
    }

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

Files: 
CommentFileSizeAuthor
#4 fix-variable-1886812-4.patch496 byteskiamlaluno
PASSED: [[SimpleTest]]: [MySQL] 39,786 pass(es). View
#1 fix-variable-1886812-1.patch524 byteskiamlaluno
PASSED: [[SimpleTest]]: [MySQL] 49,662 pass(es). View

Comments

kiamlaluno’s picture

Status: Active » Needs review
FileSize
524 bytes
PASSED: [[SimpleTest]]: [MySQL] 49,662 pass(es). View

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.

kiamlaluno’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
PASSED: [[SimpleTest]]: [MySQL] 39,786 pass(es). View
kiamlaluno’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.