| 4.7.x form.inc | theme_textfield($element) | 
| 5.x form.inc | theme_textfield($element) | 
| 6.x form.inc | theme_textfield( | 
| 7.x form.inc | 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
File
- includes/form.inc, line 2154 
Code
function theme_textfield($element) {
  $size = empty($element['#size']) ? '' : ' size="' . $element['#size'] . '"';
  $maxlength = empty($element['#maxlength']) ? '' : ' maxlength="' . $element['#maxlength'] . '"';
  $class = array('form-text');
  $extra = '';
  $output = '';
  if ($element['#autocomplete_path'] && !empty($element['#autocomplete_input'])) {
    drupal_add_js('misc/autocomplete.js');
    $class[] = 'form-autocomplete';
    $extra = '<input class="autocomplete" type="hidden" id="' . $element['#autocomplete_input']['#id'] . '" value="' . $element['#autocomplete_input']['#url_value'] . '" disabled="disabled" />';
  }
  _form_set_class($element, $class);
  if (isset($element['#field_prefix'])) {
    $output .= '<span class="field-prefix">' . $element['#field_prefix'] . '</span> ';
  }
  $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>';
  }
  return theme('form_element', $element, $output) . $extra;
}
来自 https://api.drupal.org/api/drupal/includes%21form.inc/function/theme_textfield/6.x