function page_manager_menu in Chaos Tool Suite (ctools) 7
Same name and namespace in other branches
- 6 page_manager/page_manager.module \page_manager_menu()
Delegated implementation of hook_menu().
File
- page_manager/
page_manager.module, line 86 - The page manager module provides a UI and API to manage pages.
Code
function page_manager_menu() {
// 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;
}
$items = array();
$base = array(
'access arguments' => array(
'use page manager',
),
'file' => 'page_manager.admin.inc',
'theme callback' => 'ajax_base_page_theme',
);
$items['admin/structure/pages'] = array(
'title' => 'Pages',
'description' => 'Add, edit and remove overridden system pages and user defined pages from the system.',
'page callback' => 'page_manager_list_page',
) + $base;
$items['admin/structure/pages/list'] = array(
'title' => 'List',
'page callback' => 'page_manager_list_page',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
) + $base;
$items['admin/structure/pages/edit/%page_manager_cache'] = array(
'title' => 'Edit',
'page callback' => 'page_manager_edit_page',
'page arguments' => array(
4,
),
'type' => MENU_NORMAL_ITEM,
) + $base;
$items['admin/structure/pages/%ctools_js/operation/%page_manager_cache'] = array(
'page callback' => 'page_manager_edit_page_operation',
'page arguments' => array(
3,
5,
),
'type' => MENU_NORMAL_ITEM,
) + $base;
$items['admin/structure/pages/%ctools_js/enable/%page_manager_cache'] = array(
'page callback' => 'page_manager_enable_page',
'page arguments' => array(
FALSE,
3,
5,
),
'type' => MENU_CALLBACK,
) + $base;
$items['admin/structure/pages/%ctools_js/disable/%page_manager_cache'] = array(
'page callback' => 'page_manager_enable_page',
'page arguments' => array(
TRUE,
3,
5,
),
'type' => MENU_CALLBACK,
) + $base;
$tasks = page_manager_get_tasks();
// Provide menu items for each task.
foreach ($tasks as $task_id => $task) {
// Allow the task to add its own menu items.
if ($function = ctools_plugin_get_function($task, 'hook menu')) {
$function($items, $task);
}
// And for those that provide subtasks, provide menu items for them, as well.
foreach (page_manager_get_task_subtasks($task) as $subtask_id => $subtask) {
// Allow the task to add its own menu items.
if ($function = ctools_plugin_get_function($task, 'hook menu')) {
$function($items, $subtask);
}
}
}
return $items;
}