Commit 2155a540 authored by catch's avatar catch
Browse files

Issue #1309394 by effulgentsia, sun, aspilicious: Process #autocomplete_path()...

Issue #1309394 by effulgentsia, sun, aspilicious: Process #autocomplete_path() for all form elements; remove custom/duplicated code from theme_textfield().
parent 87c647b0
...@@ -4035,7 +4035,7 @@ function theme_url($variables) { ...@@ -4035,7 +4035,7 @@ function theme_url($variables) {
* An associative array containing: * An associative array containing:
* - element: An associative array containing the properties of the element. * - element: An associative array containing the properties of the element.
* Properties used: #title, #value, #description, #size, #maxlength, * Properties used: #title, #value, #description, #size, #maxlength,
* #placeholder, #required, #attributes, #autocomplete_path. * #placeholder, #required, #attributes.
* *
* @ingroup themeable * @ingroup themeable
*/ */
...@@ -4045,23 +4045,7 @@ function theme_search($variables) { ...@@ -4045,23 +4045,7 @@ function theme_search($variables) {
element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength', 'placeholder')); element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength', 'placeholder'));
_form_set_class($element, array('form-search')); _form_set_class($element, array('form-search'));
$extra = ''; return '<input' . drupal_attributes($element['#attributes']) . ' />' . drupal_render_children($element);
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;
} }
/** /**
......
...@@ -399,7 +399,7 @@ function system_element_info() { ...@@ -399,7 +399,7 @@ function system_element_info() {
'#size' => 60, '#size' => 60,
'#maxlength' => 128, '#maxlength' => 128,
'#autocomplete_path' => FALSE, '#autocomplete_path' => FALSE,
'#process' => array('ajax_process_form'), '#process' => array('form_process_autocomplete', 'ajax_process_form'),
'#theme' => 'search', '#theme' => 'search',
'#theme_wrappers' => array('form_element'), '#theme_wrappers' => array('form_element'),
); );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment