You are here

function panelizer_defaults_ui::hook_menu in Panelizer 7.2

Same name and namespace in other branches
  1. 7.3 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']);
  unset($this->plugin['menu']['items']['edit callback']);
  unset($this->plugin['menu']['items']['context']);
  unset($this->plugin['menu']['items']['content']);
  unset($this->plugin['menu']['items']['layout']);
  unset($this->plugin['menu']['items']['access']);

  // Change the callbacks for everything:
  foreach ($this->plugin['menu']['items'] as $key => $item) {
    $this->plugin['menu']['items'][$key]['access callback'] = 'panelizer_has_choice_callback';
    $this->plugin['menu']['items'][$key]['access arguments'] = array(
      4,
      5,
      '',
    );
    $this->plugin['menu']['items'][$key]['page callback'] = 'panelizer_export_ui_switcher_page';
    array_unshift($this->plugin['menu']['items'][$key]['page arguments'], 5);
    array_unshift($this->plugin['menu']['items'][$key]['page arguments'], 4);
  }
  parent::hook_menu($items);
}