1 layout.module layout_page_menu_item(array $menu, array $access_arguments, array $page_arguments, array $load_arguments)

Create a menu item for Layout-provided pages.

Parameters

array $menu: The configuration for this menu item as configured by the user.

$access_arguments: The arguments for the menu system.

$page_arguments: The page callback arguments for the menu system.

$load_arguments: The magic loader arguments for the menu system.

Return value

array: The menu item array.

File

core/modules/layout/layout.module, line 581
The Layout module creates pages and wraps existing pages in layouts.

Code

function layout_page_menu_item(array $menu, array $access_arguments, array $page_arguments, array $load_arguments) {
  $item = array(
    'access callback' => 'layout_page_access',
    'access arguments' => $access_arguments,
    'page callback' => 'layout_page_callback',
    'page arguments' => $page_arguments,
    'load arguments' => $load_arguments,
    'file' => 'layout.pages.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 '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 'action':
      $item['type'] = MENU_LOCAL_ACTION;
      break;
    case 'default tab':
      $item['type'] = MENU_DEFAULT_LOCAL_TASK;
      break;
    case 'none':
    default:
      $item['type'] = MENU_CALLBACK;
      break;
  }

  return $item;
}