function ctools_context_handler_pre_render in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 ctools.api.php \ctools_context_handler_pre_render()
- 7 includes/context-task-handler.inc \ctools_context_handler_pre_render()
Called to execute actions that should happen before a handler is rendered.
1 call to ctools_context_handler_pre_render()
- page_manager_http_response_render in page_manager/
plugins/ task_handlers/ http_response.inc
File
- includes/
context-task-handler.inc, line 131 - Support for creating 'context' type task handlers.
Code
function ctools_context_handler_pre_render($handler, $contexts, $args) {
$plugin = page_manager_get_task_handler($handler->handler);
if (user_access('administer page manager') && isset($handler->task)) {
// Provide a tab to edit this context:
ctools_include('menu');
$task = page_manager_get_task($handler->task);
$title = !empty($task['tab title']) ? $task['tab title'] : t('Edit @type', array(
'@type' => $plugin['title'],
));
$trail = array();
if (!empty($plugin['tab operation'])) {
if (is_array($plugin['tab operation'])) {
$trail = $plugin['tab operation'];
}
else {
if (function_exists($plugin['tab operation'])) {
$trail = $plugin['tab operation']($handler, $contexts, $args);
}
}
}
ctools_menu_add_tab(array(
'title' => $title,
'href' => page_manager_edit_url(page_manager_make_task_name($handler->task, $handler->subtask), $trail),
));
}
}