function panels_layouts_ui::hook_menu in Panels 7.3
Same name and namespace in other branches
- 6.3 plugins/export_ui/panels_layouts_ui.class.php \panels_layouts_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/ panels_layouts_ui.class.php, line 10 - Contains the administrative UI for reusable layouts.
Class
- panels_layouts_ui
- @file Contains the administrative UI for reusable layouts.
Code
function hook_menu(&$items) {
// During updates, this can run before our schema is set up, so our
// plugin can be empty.
if (empty($this->plugin['menu']['items']['add'])) {
return;
}
// Change the item to a tab on the Panels page.
$this->plugin['menu']['items']['list callback']['type'] = MENU_LOCAL_TASK;
// Establish a base for adding plugins.
$base = $this->plugin['menu']['items']['add'];
// Remove the default 'add' menu item.
unset($this->plugin['menu']['items']['add']);
ctools_include('plugins', 'panels');
$this->builders = panels_get_layout_builders();
asort($this->builders);
foreach ($this->builders as $name => $builder) {
// Create a new menu item for the builder.
$item = $base;
$item['title'] = !empty($builder['builder tab title']) ? $builder['builder tab title'] : 'Add ' . $builder['title'];
$item['page arguments'][] = $name;
$item['path'] = 'add-' . $name;
$this->plugin['menu']['items']['add ' . $name] = $item;
}
parent::hook_menu($items);
}