You are here

function apachesolr_autocomplete_init in Apache Solr Autocomplete 6

Same name and namespace in other branches
  1. 7.2 apachesolr_autocomplete.module \apachesolr_autocomplete_init()
  2. 7 apachesolr_autocomplete.module \apachesolr_autocomplete_init()

Implementation of hook_init().

File

./apachesolr_autocomplete.module, line 12
Alters search forms to suggest terms using Apache Solr using AJAX. Thanks to robertDouglass who contributed some of the code.

Code

function apachesolr_autocomplete_init() {
  drupal_add_css(drupal_get_path('module', 'apachesolr_autocomplete') . '/apachesolr_autocomplete.css');

  // If using custom JS widget, include files and settings.
  if (apachesolr_autocomplete_variable_get_widget() == 'custom') {

    // Add custom autocomplete files
    drupal_add_js(drupal_get_path('module', 'apachesolr_autocomplete') . '/apachesolr_autocomplete.js');
    drupal_add_js(drupal_get_path('module', 'apachesolr_autocomplete') . '/jquery-autocomplete/jquery.autocomplete.js');
    drupal_add_css(drupal_get_path('module', 'apachesolr_autocomplete') . '/jquery-autocomplete/jquery.autocomplete.css');

    // Specify path to autocomplete handler.
    drupal_add_js(array(
      'apachesolr_autocomplete' => array(
        'path' => url('apachesolr_autocomplete'),
      ),
    ), 'setting');
  }
}