You are here

function theme_hierarchical_select_textfield in Hierarchical Select 5.3

Same name and namespace in other branches
  1. 6.3 includes/theme.inc \theme_hierarchical_select_textfield()

Format a textfield in the .hierarchial-select div: prevent it from being wrapped in a div. This simplifies the CSS and JS code.

Parameters

$element: An associative array containing the properties of the element.

Return value

A themed HTML string representing the form element.

1 theme call to theme_hierarchical_select_textfield()
hierarchical_select_process in ./hierarchical_select.module
Hierarchical select form element type #process callback.

File

./hierarchical_select.module, line 2333
This module defines the "hierarchical_select" form element, which is a greatly enhanced way for letting the user select items in a hierarchy.

Code

function theme_hierarchical_select_textfield($element) {
  $size = $element['#size'] ? ' size="' . $element['#size'] . '"' : '';
  $class = array(
    'form-text',
  );
  $extra = '';
  $output = '';
  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);
  if (isset($element['#field_prefix'])) {
    $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']) . ' />';
  if (isset($element['#field_suffix'])) {
    $output .= ' <span class="field-suffix">' . $element['#field_suffix'] . '</span>';
  }
  return $output . $extra;
}