You are here

function page_manager_get_task_handler_plugins in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 page_manager/page_manager.module \page_manager_get_task_handler_plugins()

Retrieve a list of all applicable task handlers for a given task.

This looks at the $task['handler type'] and compares that to $task_handler['handler type']. If the task has no type, the id of the task is used instead.

2 calls to page_manager_get_task_handler_plugins()
page_manager_handler_add_form in page_manager/page_manager.admin.inc
Provide a consistent UI for adding handlers.
page_manager_page_add_subtask in page_manager/plugins/tasks/page.admin.inc
Page callback to add a subtask.

File

page_manager/page_manager.module, line 917
The page manager module provides a UI and API to manage pages.

Code

function page_manager_get_task_handler_plugins($task, $all = FALSE) {
  $type = isset($task['handler type']) ? $task['handler type'] : $task['name'];
  $name = $task['name'];
  $handlers = array();
  $task_handlers = page_manager_get_task_handlers();
  foreach ($task_handlers as $id => $handler) {
    $task_type = is_array($handler['handler type']) ? $handler['handler type'] : array(
      $handler['handler type'],
    );
    if (in_array($type, $task_type) || in_array($name, $task_type)) {
      if ($all || !empty($handler['visible'])) {
        $handlers[$id] = $handler;
      }
    }
  }
  return $handlers;
}