Révision 7e72b748
Ajouté par Assos Assos il y a plus de 6 ans
drupal7/sites/all/modules/ctools/includes/context-task-handler.inc | ||
---|---|---|
31 | 31 |
* If TRUE then this renderer owns the page and can use theme('page') |
32 | 32 |
* for no blocks; if false, output is returned regardless of any no |
33 | 33 |
* blocks settings. |
34 |
* |
|
34 | 35 |
* @return |
35 | 36 |
* Either the output or NULL if there was output, FALSE if no handler |
36 | 37 |
* accepted the task. If $page is FALSE then the $info block is returned instead. |
... | ... | |
84 | 85 |
*/ |
85 | 86 |
function ctools_context_handler_default_test($handler, $base_contexts, $args) { |
86 | 87 |
ctools_include('context'); |
87 |
// Add my contexts |
|
88 |
// Add my contexts.
|
|
88 | 89 |
$contexts = ctools_context_handler_get_handler_contexts($base_contexts, $handler); |
89 | 90 |
|
90 | 91 |
// Test. |
... | ... | |
128 | 129 |
'contexts' => $contexts, |
129 | 130 |
'task' => $task, |
130 | 131 |
'subtask' => $subtask, |
131 |
'handler' => $handler |
|
132 |
'handler' => $handler,
|
|
132 | 133 |
); |
133 | 134 |
drupal_alter('ctools_render', $info, $page, $context); |
134 | 135 |
|
... | ... | |
141 | 142 |
switch ($info['response code']) { |
142 | 143 |
case 403: |
143 | 144 |
return MENU_ACCESS_DENIED; |
145 |
|
|
144 | 146 |
case 404: |
145 | 147 |
return MENU_NOT_FOUND; |
148 |
|
|
146 | 149 |
case 410: |
147 | 150 |
drupal_add_http_header('Status', '410 Gone'); |
148 | 151 |
drupal_exit(); |
149 | 152 |
break; |
153 |
|
|
150 | 154 |
case 301: |
151 | 155 |
case 302: |
152 | 156 |
case 303: |
... | ... | |
162 | 166 |
'fragment' => $info['fragment'], |
163 | 167 |
); |
164 | 168 |
drupal_goto($info['destination'], $options, $info['response code']); |
165 |
// @todo -- should other response codes be supported here? |
|
169 |
// @todo -- should other response codes be supported here?
|
|
166 | 170 |
} |
167 | 171 |
} |
168 | 172 |
|
... | ... | |
241 | 245 |
if (is_array($plugin['tab operation'])) { |
242 | 246 |
$trail = $plugin['tab operation']; |
243 | 247 |
} |
244 |
else if (function_exists($plugin['tab operation'])) {
|
|
248 |
elseif (function_exists($plugin['tab operation'])) { |
|
245 | 249 |
$trail = $plugin['tab operation']($handler, $contexts, $args); |
246 | 250 |
} |
247 | 251 |
} |
... | ... | |
251 | 255 |
'href' => $path, |
252 | 256 |
'title' => $title, |
253 | 257 |
'query' => drupal_get_destination(), |
254 |
)); |
|
258 |
), |
|
259 |
); |
|
255 | 260 |
|
256 | 261 |
return $links; |
257 | 262 |
} |
... | ... | |
259 | 264 |
/** |
260 | 265 |
* Called to execute actions that should happen before a handler is rendered. |
261 | 266 |
*/ |
262 |
function ctools_context_handler_pre_render($handler, $contexts, $args) { } |
|
267 |
function ctools_context_handler_pre_render($handler, $contexts, $args) { |
|
268 |
foreach (module_implements('ctools_context_handler_pre_render') as $module) { |
|
269 |
$function = $module . '_ctools_context_handler_pre_render'; |
|
270 |
$function($handler, $contexts, $args); |
|
271 |
} |
|
272 |
} |
|
263 | 273 |
|
264 | 274 |
/** |
265 | 275 |
* Compare arguments to contexts for selection purposes. |
... | ... | |
320 | 330 |
// the task handler, for example) but sometimes we need them separately |
321 | 331 |
// (when a task has contexts loaded and is trying out the task handlers, |
322 | 332 |
// for example). Therefore there are two paths we can take to getting contexts. |
323 |
|
|
324 | 333 |
/** |
325 | 334 |
* Load the contexts for a task, using arguments. |
326 | 335 |
* |
... | ... | |
368 | 377 |
* expects things in a certain, kind of clunky format. |
369 | 378 |
*/ |
370 | 379 |
function ctools_context_handler_get_handler_object($handler) { |
371 |
$object = new stdClass; |
|
380 |
$object = new stdClass();
|
|
372 | 381 |
$object->name = $handler->name; |
373 | 382 |
$object->contexts = isset($handler->conf['contexts']) ? $handler->conf['contexts'] : array(); |
374 | 383 |
$object->relationships = isset($handler->conf['relationships']) ? $handler->conf['relationships'] : array(); |
... | ... | |
382 | 391 |
* arguments from the task. |
383 | 392 |
*/ |
384 | 393 |
function ctools_context_handler_get_task_object($task, $subtask, $handler) { |
385 |
$object = new stdClass; |
|
394 |
$object = new stdClass();
|
|
386 | 395 |
$object->name = !empty($handler->name) ? $handler->name : 'temp'; |
387 | 396 |
$object->base_contexts = ctools_context_handler_get_base_contexts($task, $subtask, TRUE); |
388 | 397 |
$object->arguments = ctools_context_handler_get_task_arguments($task, $subtask); |
... | ... | |
456 | 465 |
ctools_modal_add_plugin_js(ctools_get_access_plugins()); |
457 | 466 |
ctools_include('context-access-admin'); |
458 | 467 |
$form_state['module'] = (isset($form_state['module'])) ? $form_state['module'] : 'page_manager_task_handler'; |
459 |
// Encode a bunch of info into the argument so we can get our cache later |
|
468 |
// Encode a bunch of info into the argument so we can get our cache later.
|
|
460 | 469 |
$form_state['callback argument'] = $form_state['task_name'] . '*' . $form_state['handler']->name; |
461 | 470 |
$form_state['access'] = $form_state['handler']->conf['access']; |
462 | 471 |
$form_state['no buttons'] = TRUE; |
... | ... | |
472 | 481 |
} |
473 | 482 |
|
474 | 483 |
/** |
475 |
* Submit handler for rules selection |
|
484 |
* Submit handler for rules selection.
|
|
476 | 485 |
*/ |
477 | 486 |
function ctools_context_handler_edit_criteria_submit(&$form, &$form_state) { |
478 | 487 |
$form_state['handler']->conf['access']['logic'] = $form_state['values']['logic']; |
... | ... | |
537 | 546 |
unset($form_state['page']->context_cache[$cache_name]); |
538 | 547 |
} |
539 | 548 |
} |
540 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules