function theme_finder_autocomplete_textfield in Finder 7.2
Same name and namespace in other branches
- 6 modules/finder_autocomplete/finder_autocomplete.module \theme_finder_autocomplete_textfield()
- 7 modules/finder_autocomplete/finder_autocomplete.module \theme_finder_autocomplete_textfield()
Format a finder autocomplete textfield.
Parameters
$variables: An array with keys: 'element' - The Forms API form element.
File
- plugins/
element_handler/ autocomplete.inc, line 403 - The finder autocomplete element handler plugin.
Code
function theme_finder_autocomplete_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 (!empty($element['#autocomplete_path']) && drupal_valid_path($element['#autocomplete_path'])) {
drupal_add_js(drupal_get_path('module', 'finder') . '/plugins/element_handler/autocomplete.js');
$settings['finder_autocomplete'][$element['#attributes']['id']]['autosubmit'] = (bool) $element['#autosubmit'];
drupal_add_js($settings, 'setting');
$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'][] = 'finder-autocomplete';
$extra = '<input' . drupal_attributes($attributes) . ' />';
}
$output = '<input' . drupal_attributes($element['#attributes']) . ' />';
return $output . $extra;
}