function ctools_task_handler_default_contextual_link in Chaos Tool Suite (ctools) 7
Provides contextual link for a task as defined by the handler.
This provides a simple link to th main content operation and is suitable for most normal handlers. Setting 'contextual link' to a function overrides this and setting it to FALSE will prevent a contextual link from appearing.
1 string reference to 'ctools_task_handler_default_contextual_link'
- ctools_context_handler_render_handler in includes/
context-task-handler.inc - Render a task handler.
File
- includes/
context-task-handler.inc, line 235 - Support for creating 'context' type task handlers.
Code
function ctools_task_handler_default_contextual_link($handler, $plugin, $contexts, $args) {
if (!user_access('administer page manager')) {
return;
}
$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'];
}
elseif (function_exists($plugin['tab operation'])) {
$trail = $plugin['tab operation']($handler, $contexts, $args);
}
}
$path = page_manager_edit_url(page_manager_make_task_name($handler->task, $handler->subtask), $trail);
$links = array(
array(
'href' => $path,
'title' => $title,
'query' => drupal_get_destination(),
),
);
return $links;
}