Révision c304a780
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/search.inc | ||
---|---|---|
10 | 10 |
*/ |
11 | 11 |
|
12 | 12 |
/** |
13 |
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for |
|
14 |
* more information. |
|
13 |
* Specialized implementation of hook_page_manager_task_tasks(). |
|
14 |
* |
|
15 |
* See api-task.html for more information. |
|
15 | 16 |
*/ |
16 | 17 |
function page_manager_search_page_manager_tasks() { |
17 | 18 |
if (!module_exists('search')) { |
... | ... | |
19 | 20 |
} |
20 | 21 |
|
21 | 22 |
return array( |
22 |
// This is a 'page' task and will fall under the page admin UI |
|
23 |
// This is a 'page' task and will fall under the page admin UI.
|
|
23 | 24 |
'task type' => 'page', |
24 | 25 |
'title' => t('Search'), |
25 | 26 |
|
... | ... | |
38 | 39 |
'get arguments' => 'page_manager_search_get_arguments', |
39 | 40 |
'get context placeholders' => 'page_manager_search_get_contexts', |
40 | 41 |
'access callback' => 'page_manager_search_access_check', |
41 |
|
|
42 | 42 |
); |
43 | 43 |
} |
44 | 44 |
|
... | ... | |
59 | 59 |
// keywords. A second set is for searching *with* keywords. This |
60 | 60 |
// is necessary because search/node/% and search/node need to be |
61 | 61 |
// different due to the way the search menu items function. |
62 |
|
|
63 | 62 |
$default_info = search_get_default_module_info(); |
64 | 63 |
if (empty($default_info)) { |
65 | 64 |
// Nothing to do. |
... | ... | |
85 | 84 |
$items["$path/%menu_tail"]['file'] = $task['file']; |
86 | 85 |
} |
87 | 86 |
else { |
88 |
// automatically disable this task if it cannot be enabled.
|
|
87 |
// Automatically disable this task if it cannot be enabled.
|
|
89 | 88 |
variable_set('page_manager_search_disabled_' . $module, TRUE); |
90 | 89 |
if (!empty($GLOBALS['page_manager_enabling_search'])) { |
91 | 90 |
drupal_set_message(t('Page manager module is unable to enable @path because some other module already has overridden with %callback.', array('%callback' => $callback, '@path' => $path)), 'error'); |
... | ... | |
96 | 95 |
|
97 | 96 |
/** |
98 | 97 |
* Entry point for our overridden search page. |
99 |
* |
|
100 | 98 |
*/ |
101 | 99 |
function page_manager_search_page($type) { |
102 | 100 |
ctools_include('menu'); |
103 |
// menu_set_active_trail(ctools_get_menu_trail('search/' . $type)); |
|
104 |
|
|
105 | 101 |
// Get the arguments and construct a keys string out of them. |
106 | 102 |
$args = func_get_args(); |
107 | 103 |
|
... | ... | |
111 | 107 |
// And implode() it all back together. |
112 | 108 |
$keys = $args ? implode('/', $args) : ''; |
113 | 109 |
|
114 |
// Allow other modules to alter the search keys |
|
115 |
drupal_alter(array('search_keys', 'search_'. $type .'_keys'), $keys);
|
|
110 |
// Allow other modules to alter the search keys.
|
|
111 |
drupal_alter(array('search_keys', 'search_' . $type . '_keys'), $keys);
|
|
116 | 112 |
|
117 |
// Load my task plugin |
|
113 |
// Load my task plugin.
|
|
118 | 114 |
$task = page_manager_get_task('search'); |
119 | 115 |
$subtask = page_manager_get_task_subtask($task, $type); |
120 | 116 |
|
... | ... | |
138 | 134 |
} |
139 | 135 |
|
140 | 136 |
// Otherwise, fall back. |
141 |
|
|
142 | 137 |
// Put the $type back on the arguments. |
143 | 138 |
module_load_include('inc', 'search', 'search.pages'); |
144 | 139 |
array_unshift($args, $type); |
... | ... | |
224 | 219 |
'row class' => empty($page->disabled) ? 'page-manager-enabled' : 'page-manager-disabled', |
225 | 220 |
'storage' => t('In code'), |
226 | 221 |
'disabled' => variable_get('page_manager_search_disabled_' . $module, TRUE), |
227 |
// This works for both enable AND disable |
|
222 |
// This works for both enable AND disable.
|
|
228 | 223 |
'enable callback' => 'page_manager_search_enable', |
229 | 224 |
); |
230 | 225 |
|
... | ... | |
240 | 235 |
* The subtask id |
241 | 236 |
* @param $contexts |
242 | 237 |
* The contexts loaded for the task. |
238 |
* |
|
243 | 239 |
* @return |
244 | 240 |
* TRUE if the current user can access the page. |
245 | 241 |
*/ |
Formats disponibles : Unified diff
Weekly update of contrib modules