theme_textfield
- Versions
- 4.7 – 6
theme_textfield($element)- 7
theme_textfield($variables)
Format a textfield.
Parameters
$element An associative array containing the properties of the element. Properties used: title, value, description, size, maxlength, required, attributes autocomplete_path
Return value
A themed HTML string representing the textfield.
Related topics
Code
includes/form.inc, line 1032
<?php
function theme_textfield($element) {
$size = $element['#size'] ? ' size="' . $element['#size'] . '"' : '';
$class = array('form-text');
$extra = '';
if ($element['#autocomplete_path']) {
drupal_add_js('misc/autocomplete.js');
$class[] = 'form-autocomplete';
$extra = '<input class="autocomplete" type="hidden" id="'. $element['#id'] .'-autocomplete" value="'. check_url(url($element['#autocomplete_path'], NULL, NULL, TRUE)) .'" disabled="disabled" />';
}
_form_set_class($element, $class);
$output = '<input type="text" maxlength="'. $element['#maxlength'] .'" name="'. $element['#name'] .'" id="'. $element['#id'] .'" '. $size .' value="'. check_plain($element['#value']) .'"'. drupal_attributes($element['#attributes']) .' />';
return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], form_get_error($element)). $extra;
}
?>Login or register to post comments 