You are here

function page_manager_menu_alter in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 page_manager/page_manager.module \page_manager_menu_alter()

Implementation of hook_menu_alter.

Get a list of all tasks and delegate to them.

File

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

Code

function page_manager_menu_alter(&$items) {

  // For some reason, some things can activate modules without satisfying
  // dependencies. I don't know how, but this helps prevent things from
  // whitescreening when this happens.
  if (!module_exists('ctools')) {
    return;
  }
  $tasks = page_manager_get_tasks();
  foreach ($tasks as $task) {
    if ($function = ctools_plugin_get_function($task, 'hook menu alter')) {
      $function($items, $task);
    }

    // let the subtasks alter the menu items too.
    foreach (page_manager_get_task_subtasks($task) as $subtask_id => $subtask) {
      if ($function = ctools_plugin_get_function($subtask, 'hook menu alter')) {
        $function($items, $subtask);
      }
    }
  }
  return $items;
}