function theme_textfield

7.x form.inc theme_textfield($variables)
5.x form.inc theme_textfield($element)
6.x form.inc theme_textfield($element)

Returns HTML for a textfield form element.

Parameters

$variables: An associative array containing:

  • element: An associative array containing the properties of the element. Properties used: #title, #value, #description, #size, #maxlength, #required, #attributes, #autocomplete_path.

Related topics

147 string references to the theme hook from theme_textfield()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

aggregator_admin_form in drupal/modules/aggregator/aggregator.admin.inc
Form constructor for the aggregator system settings.
aggregator_form_category in drupal/modules/aggregator/aggregator.admin.inc
Form constructor to add/edit/delete aggregator categories.
aggregator_form_feed in drupal/modules/aggregator/aggregator.admin.inc
Form constructor for adding and editing feed sources.
aggregator_form_opml in drupal/modules/aggregator/aggregator.admin.inc
Form constructor for importing feeds from OPML.
ajax_forms_test_validation_form in drupal/modules/simpletest/tests/ajax_forms_test.module
This form and its related submit and callback functions demonstrate not validating another form element when a single Ajax element is triggered.

... See full list

File

drupal/includes/form.inc, line 3889
Functions for form and batch generation and processing.

Code

function theme_textfield($variables) {
  $element = $variables['element'];
  $element['#attributes']['type'] = 'text';
  element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength'));
  _form_set_class($element, array('form-text'));

  $extra = '';
  if ($element['#autocomplete_path'] && drupal_valid_path($element['#autocomplete_path'])) {
    drupal_add_library('system', 'drupal.autocomplete');
    $element['#attributes']['class'][] = 'form-autocomplete';

    $attributes = array();
    $attributes['type'] = 'hidden';
    $attributes['id'] = $element['#attributes']['id'] . '-autocomplete';
    $attributes['value'] = url($element['#autocomplete_path'], array('absolute' => TRUE));
    $attributes['disabled'] = 'disabled';
    $attributes['class'][] = 'autocomplete';
    $extra = '<input' . drupal_attributes($attributes) . ' />';
  }

  $output = '<input' . drupal_attributes($element['#attributes']) . ' />';

  return $output . $extra;
}