function panelizer_defaults_ui::hook_menu in Panelizer 7.3
Same name and namespace in other branches
- 7.2 plugins/export_ui/panelizer_defaults_ui.class.php \panelizer_defaults_ui::hook_menu()
hook_menu() entry point.
Child implementations that need to add or modify menu items should probably call parent::hook_menu($items) and then modify as needed.
Overrides ctools_export_ui::hook_menu
File
- plugins/
export_ui/ panelizer_defaults_ui.class.php, line 16 - Contains the administrative UI for selectable panelizer defaults.
Class
- panelizer_defaults_ui
- @file Contains the administrative UI for selectable panelizer defaults.
Code
function hook_menu(&$items) {
// Change the item to a tab.
$this->plugin['menu']['items']['list']['type'] = MENU_LOCAL_TASK;
$this->plugin['menu']['items']['list']['weight'] = -6;
$this->plugin['menu']['items']['list']['title'] = 'List defaults';
// menu local actions are weird.
$this->plugin['menu']['items']['add']['path'] = 'list/add';
$this->plugin['menu']['items']['import']['path'] = 'list/import';
// Edit is being handled elsewhere.
unset($this->plugin['menu']['items']['edit callback']);
unset($this->plugin['menu']['items']['access']);
foreach (panelizer_operations() as $path => $operation) {
$location = isset($operation['ui path']) ? $operation['ui path'] : $path;
if (isset($this->plugin['menu']['items'][$location])) {
unset($this->plugin['menu']['items'][$location]);
}
}
// Change the callbacks for everything.
foreach ($this->plugin['menu']['items'] as $key => $item) {
// The item has already been set; continue to next item to avoid shifting
// items onto the page arguments array more than once.
if ($this->plugin['menu']['items'][$key]['access callback'] == 'panelizer_has_choice_callback') {
continue;
}
$this->plugin['menu']['items'][$key]['access callback'] = 'panelizer_has_choice_callback';
$this->plugin['menu']['items'][$key]['access arguments'] = array(
3,
4,
'',
);
$this->plugin['menu']['items'][$key]['page callback'] = 'panelizer_export_ui_switcher_page';
array_unshift($this->plugin['menu']['items'][$key]['page arguments'], 4);
array_unshift($this->plugin['menu']['items'][$key]['page arguments'], 3);
}
parent::hook_menu($items);
}