Download & Extend

theme_form_element() initialize a variable that is never used

Project:Drupal core
Version:7.x-dev
Component:forms system
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:needs backport to D7

Issue Summary

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

The function contains the following code.

<?php
  $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.

<?php
   
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.

Comments

#1

Status:active» needs review

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

AttachmentSizeStatusTest resultOperations
fix-variable-1886812-1.patch524 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 49,662 pass(es).View details

#2

Status:needs review» reviewed & tested by the community

#3

Status:reviewed & tested by the community» fixed

Thanks! Committed/pushed to 8.x.

#4

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 report» task
Status:fixed» needs review
Issue tags:-Novice+needs backport to D7
AttachmentSizeStatusTest resultOperations
fix-variable-1886812-4.patch496 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 39,786 pass(es).View details

#5

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.

#6

Status:needs review» reviewed & tested by the community

Good to go.

#7

Status:reviewed & tested by the community» fixed

Committed to 7.x - thanks! http://drupalcode.org/project/drupal.git/commit/9ae47ea

#8

Status:fixed» closed (fixed)

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

nobody click here