From e58739a1203d2e33b7498c28da84265dd2d21196 Mon Sep 17 00:00:00 2001
From: Bram Goffings <bramgoffings@gmail.com>
Date: Sun, 15 Apr 2012 17:52:50 +0200
Subject: [PATCH 2/2] search autocomplete

---
 core/includes/form.inc            |   18 +-----------------
 core/modules/system/system.module |    2 +-
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/core/includes/form.inc b/core/includes/form.inc
index ae04144..f001475 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -4016,23 +4016,7 @@ function theme_search($variables) {
   element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength', 'placeholder'));
   _form_set_class($element, array('form-search'));
 
-  $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;
+  return '<input' . drupal_attributes($element['#attributes']) . ' />' . drupal_render_children($element);
 }
 
 /**
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index a3594b9..6fb56e3 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -399,7 +399,7 @@ function system_element_info() {
     '#size' => 60,
     '#maxlength' => 128,
     '#autocomplete_path' => FALSE,
-    '#process' => array('ajax_process_form'),
+    '#process' => array('form_process_autocomplete', 'ajax_process_form'),
     '#theme' => 'search',
     '#theme_wrappers' => array('form_element'),
   );
-- 
1.7.5.4

