-
Notifications
You must be signed in to change notification settings - Fork 7
/
islandora_authority.module
123 lines (110 loc) · 3.01 KB
/
islandora_authority.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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
/**
* @file
* General hook implementations.
*/
/**
* Implements hook_element_info().
*/
function islandora_authority_element_info() {
$elements = array();
$mod_path = drupal_get_path('module', 'islandora_authority');
$elements['islandora_authority_textfield'] = array(
'#theme' => 'islandora_authority_textfield',
'#theme_wrappers' => array('form_element'),
'#input' => TRUE,
'#size' => 60,
'#maxlength' => 128,
'#autocomplete_path' => 'islandora/authority',
'#process' => array(
'ajax_process_form',
'islandora_authority_load_theme_file',
'islandora_authority_textfield_process',
'islandora_authority_element_process',
),
'#attached' => array(
'library' => array(
array('system', 'drupal.autocomplete'),
),
'js' => array(
"$mod_path/js/autocomplete.js",
),
'css' => array(
"$mod_path/css/autocomplete.css",
),
),
);
$elements['islandora_authority_hidden'] = array(
'#theme' => 'hidden',
'#input' => TRUE,
'#process' => array(
'islandora_authority_load_theme_file',
'islandora_authority_element_process',
),
);
$elements['islandora_authority_select'] = array(
'#input' => TRUE,
'#multiple' => FALSE,
'#process' => array(
'form_process_select',
'ajax_process_form',
'islandora_authority_load_theme_file',
'islandora_authority_element_process',
),
'#theme' => 'select',
'#theme_wrappers' => array('form_element'),
);
return $elements;
}
/**
* Implements hook_menu().
*/
function islandora_authority_menu() {
$items = array();
$items['islandora/authority'] = array(
'page callback' => 'islandora_authority_autocomplete',
// XXX: Access should be enforced inside the underlying controllers, as
// necessary.
'access callback' => TRUE,
'type' => MENU_CALLBACK,
'file' => 'includes/callback.inc',
);
$items['islandora/authority-validate'] = array(
'page callback' => 'islandora_authority_validate',
// XXX: Access should be enforced inside the underlying controllers, as
// necessary.
'access callback' => TRUE,
'type' => MENU_CALLBACK,
'file' => 'includes/callback.inc',
);
return $items;
}
/**
* Implements hook_theme().
*/
function islandora_authority_theme() {
$items = array();
$items['islandora_authority_textfield'] = array(
'render element' => 'element',
'file' => 'theme/theme.inc',
);
return $items;
}
/**
* Process so we can process.
*
* Drupal is silly and does not allow a file to be loaded reliably when loading
* an element.
*/
function islandora_authority_load_theme_file($element, &$form_state, $complete_form) {
form_load_include($form_state, 'inc', 'islandora_authority', 'theme/theme');
return $element;
}
/**
* Implements hook_islandora_authority_controllers().
*/
function islandora_authority_islandora_authority_controllers() {
return array(
IslandoraAuthoritySolrController::NAME => 'IslandoraAuthoritySolrController',
);
}