forked from artesis/ting_search_autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathting_search_autocomplete.module
41 lines (34 loc) · 1.25 KB
/
ting_search_autocomplete.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Implementation of hook_menu().
*/
function ting_search_autocomplete_menu() {
$items = array();
$items['ting/autocomplete'] = array(
'title' => 'Ting search autocomplete',
'description' => 'Returns a list of suggestions to use for autocompletion',
'access arguments' => array('search content'),
'page callback' => 'ting_search_autocomplete',
'type' => MENU_CALLBACK,
'file' => 'ting_search_autocomplete.pages.inc',
);
return $items;
}
/**
* Implementation of hook_flush_caches().
*/
function ting_search_autocomplete_flush_caches() {
return array('cache_ting_search_autocomplete');
}
/**
* Implements hook_form_alter() for the ting_search_autocomplete form.
*/
function ting_search_autocomplete_form_search_block_form_alter(&$form, &$form_state) {
$scan_url = variable_get('ting_scan_url', '');
$spell_url = variable_get('ting_spell_url', '');
if (!empty($scan_url) && !empty($spell_url)) {
drupal_add_library('system', 'ui.autocomplete');
drupal_add_css(drupal_get_path('module', 'ting_search_autocomplete') . '/css/ting_search_autocomplete.css');
drupal_add_js(drupal_get_path('module', 'ting_search_autocomplete') . '/js/ting_search_autocomplete.js');
}
}