This repository was archived by the owner on Feb 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdul_bento.module
More file actions
executable file
·91 lines (65 loc) · 2.2 KB
/
dul_bento.module
File metadata and controls
executable file
·91 lines (65 loc) · 2.2 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
function dul_bento_menu() {
$items = array(
'admin/config/bento' => array(
'title' => 'Bento Search',
'description' => 'Set the URL for search results',
'page callback' => 'drupal_get_form',
'page arguments' => array('dul_bento_admin_settings'),
'access arguments' => array('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
'file' => 'dul_bento.admin.inc',
),
);
//$items['find/bento'] = array(
$items[variable_get('dul_bento.results_url', '')] = array(
'title' => variable_get('dul_bento.results_title', ''),
'page callback' => 'dul_bento_search_results',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
/**
* Implements hook_theme
*/
function dul_bento_theme() {
return array(
'the_results' => array(
'template' => 'bento',
'variables' => array(
'queryTerms' => NULL,
'requestURL' => NULL,
),
),
);
}
/**
* Implements page callback for overall search results
*/
function dul_bento_search_results() {
$page = array();
// check for admin setting
$bentoIndex = variable_get('dul_bento.bento_results_index', '');
if ($bentoIndex == 0) {
$noindex_meta_tag = array(
'#tag' => 'meta',
'#attributes' => array(
'name' => 'robots',
'content' => 'noindex',
),
);
drupal_add_html_head($noindex_meta_tag, 'install_meta_robots');
}
drupal_add_css(drupal_get_path('module', 'dul_bento') . '/assets/css/styles.min.css' , array('preprocess' => FALSE));
drupal_add_js(drupal_get_path('module', 'dul_bento') . '/assets/js/scripts.min.js', array('preprocess' => FALSE));
drupal_add_js('https://www.google.com/jsapi', 'external');
drupal_add_js(drupal_get_path('module', 'dul_bento') . '/assets/js/google_search.js', array('preprocess' => TRUE));
drupal_add_js('https://find.library.duke.edu/assets/autosuggest/index.js', 'external');
drupal_add_css('https://find.library.duke.edu/assets/dul_argon/catalog-autosuggest.css', 'external');
$page['results_content'] = array (
'#theme' => 'the_results',
'#queryTerms' => 'queryTerms',
);
return $page;
}