You are here

function page_manager_page_menu_item in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 page_manager/plugins/tasks/page.admin.inc \page_manager_page_menu_item()

Create a menu item for page manager pages.

Parameters

$menu: The configuration to use. It will contain a type, and depending on the type may also contain weight, title and name. These are presumed to have been configured from the UI.

$access_arguments: Arguments that go with ctools_access_menu; it should be loaded with the access plugin type, settings, and positions of any arguments that may produce contexts.

$page_arguments: This should be seeded with the subtask name for easy loading and like the access arguments above should contain positions of arguments so that the menu system passes contexts through.

$load_arguments: Arguments to send to the arg loader; should be the subtask id and '%index'.

1 call to page_manager_page_menu_item()
page_manager_page_menu in page_manager/plugins/tasks/page.admin.inc
Delegated implementation of hook_menu().

File

page_manager/plugins/tasks/page.admin.inc, line 145
Administrative functions for the page subtasks.

Code

function page_manager_page_menu_item($task, $menu, $access_arguments, $page_arguments, $load_arguments) {
  $item = array(
    'access callback' => 'ctools_access_menu',
    'access arguments' => $access_arguments,
    'page callback' => 'page_manager_page_execute',
    'page arguments' => $page_arguments,
    'load arguments' => $load_arguments,
    'file' => 'plugins/tasks/page.inc',
  );
  if (isset($menu['title'])) {
    $item['title'] = $menu['title'];
  }
  if (isset($menu['weight'])) {
    $item['weight'] = $menu['weight'];
  }
  if (empty($menu['type'])) {
    $menu['type'] = 'none';
  }
  switch ($menu['type']) {
    case 'none':
    default:
      $item['type'] = MENU_CALLBACK;
      break;
    case 'normal':
      $item['type'] = MENU_NORMAL_ITEM;

      // Insert item into the proper menu
      $item['menu_name'] = $menu['name'];
      break;
    case 'tab':
      $item['type'] = MENU_LOCAL_TASK;
      break;
    case 'default tab':
      $item['type'] = MENU_DEFAULT_LOCAL_TASK;
      break;
  }
  return $item;
}