Commit db5311d1 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#85208 by neclimdul and bjaspan (slightly modified): if no maxlength was...

#85208 by neclimdul and bjaspan (slightly modified): if no maxlength was specified, do not generate an empty HTML attribute
parent 323fa356
......@@ -1698,7 +1698,8 @@ function theme_token($element) {
* A themed HTML string representing the textfield.
*/
function theme_textfield($element) {
$size = $element['#size'] ? ' size="'. $element['#size'] .'"' : '';
$size = empty($element['#size']) ? '' : ' size="'. $element['#size'] .'"';
$maxlength = empty($element['#maxlength']) ? '' : ' maxlength="'. $element['#maxlength'] .'"';
$class = array('form-text');
$extra = '';
$output = '';
......@@ -1714,7 +1715,7 @@ function theme_textfield($element) {
$output .= '<span class="field-prefix">'. $element['#field_prefix'] .'</span> ';
}
$output .= '<input type="text" maxlength="'. $element['#maxlength'] .'" name="'. $element['#name'] .'" id="'. $element['#id'] .'" '. $size .' value="'. check_plain($element['#value']) .'"'. drupal_attributes($element['#attributes']) .' />';
$output .= '<input type="text"'. $maxlength .' name="'. $element['#name'] .'" id="'. $element['#id'] .'"'. $size .' value="'. check_plain($element['#value']) .'"'. drupal_attributes($element['#attributes']) .' />';
if (isset($element['#field_suffix'])) {
$output .= ' <span class="field-suffix">'. $element['#field_suffix'] .'</span>';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment