# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: apachesolr_autocomplete.module
--- apachesolr_autocomplete.module Base (1.4)
+++ apachesolr_autocomplete.module Locally Modified (Based On 1.4)
@@ -38,6 +38,35 @@
 }
 
 /**
+ * Implementation of hook_form_alter().
+ *
+ * Tries to alter exposed forms from views that use apachesolr as the base table
+ */
+function apachesolr_autocomplete_form_alter(&$form, &$form_state, $form_id) {
+  if ($form_id == "views_exposed_form" && $form['text']) {
+    $form['#after_build'][] = 'apachesolr_autocomplete_views_exposed_form';
+  }
+}
+
+/**
+ * Callback for #after_build to alter apachesolr views exposed text widgets
+ *
+ * @see apachesolr_autocomplete_form_alter()
+ */
+function apachesolr_autocomplete_views_exposed_form($form, $form_element) {
+  // Is this a views that uses apachesolr as the base table?
+  if ($form_element['view']->base_table == 'apachesolr') {
+    // Add autocomplete to all text-type form elements
+    foreach ($form as $id => $data) {
+      if ($data['#type'] == 'textfield') {
+        $form[$id]['#autocomplete_path'] = 'apachesolr_autocomplete';
+      }
+    }
+  }
+  return $form;
+}
+
+/**
  * Implementation of hook_menu().
  */
 function apachesolr_autocomplete_menu() {
