public function PanelizerEntityDefault::hook_menu in Panelizer 7.2
Same name and namespace in other branches
- 7.3 plugins/entity/PanelizerEntityDefault.class.php \PanelizerEntityDefault::hook_menu()
Implements a delegated hook_menu.
Overrides PanelizerEntityInterface::hook_menu
File
- plugins/
entity/ PanelizerEntityDefault.class.php, line 248 - Base class for the Panelizer Entity plugin.
Class
- PanelizerEntityDefault
- Base class for the Panelizer Entity plugin.
Code
public function hook_menu(&$items) {
if (!empty($this->plugin['entity path'])) {
// Figure out where in the path the entity will be.
$bits = explode('/', $this->plugin['entity path']);
foreach ($bits as $count => $bit) {
if (strpos($bit, '%') === 0) {
$position = $count;
break;
}
}
if (!isset($position)) {
return;
}
$total = count($bits);
// @todo delegate the following
// Configure entity editing pages
$base = array(
'access callback' => 'panelizer_entity_plugin_callback_switcher',
'access arguments' => array(
$this->entity_type,
'access',
'admin',
$position,
'content',
),
'type' => MENU_LOCAL_TASK,
);
$items[$this->plugin['entity path'] . '/panelizer'] = array(
'title' => 'Panelizer',
// make sure this is accessible to panelize entities with no defaults.
'page callback' => 'panelizer_entity_plugin_switcher_page',
'page arguments' => array(
$this->entity_type,
'content',
$position,
),
'weight' => 11,
'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
) + $base;
$items[$this->plugin['entity path'] . '/panelizer/content'] = array(
'title' => 'Content',
'page callback' => 'panelizer_entity_plugin_switcher_page',
'page arguments' => array(
$this->entity_type,
'content',
$position,
),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 11,
) + $base;
$items[$this->plugin['entity path'] . '/panelizer/layout'] = array(
'title' => 'Layout',
'page callback' => 'panelizer_entity_plugin_switcher_page',
'page arguments' => array(
$this->entity_type,
'layout',
$position,
),
'access arguments' => array(
$this->entity_type,
'access',
'admin',
$position,
'layout',
),
'weight' => 12,
) + $base;
$items[$this->plugin['entity path'] . '/panelizer/context'] = array(
'title' => 'Context',
'page callback' => 'panelizer_entity_plugin_switcher_page',
'page arguments' => array(
$this->entity_type,
'context',
$position,
),
'access arguments' => array(
$this->entity_type,
'access',
'admin',
$position,
'context',
),
'weight' => 13,
) + $base;
$items[$this->plugin['entity path'] . '/panelizer/settings'] = array(
'title' => 'Settings',
'page callback' => 'panelizer_entity_plugin_switcher_page',
'page arguments' => array(
$this->entity_type,
'settings',
$position,
),
'access arguments' => array(
$this->entity_type,
'access',
'admin',
$position,
'settings',
),
'weight' => 14,
) + $base;
}
if (!empty($this->entity_admin_root)) {
$this
->add_admin_links($this->entity_admin_root, $this->entity_admin_bundle, $items);
}
}