You are here

function panels_page_admin_menu_items in Panels 5.2

Helper function to add a menu item for a panel.

1 call to panels_page_admin_menu_items()
panels_page_menu in panels_page/panels_page.module
Implementation of hook_menu().

File

panels_page/panels_page.module, line 190
panels_page.module

Code

function panels_page_admin_menu_items(&$items, $base, $page) {
  $access = user_access('create panel-pages');
  $items[] = array(
    'path' => $base,
    'title' => t('Preview'),
    'access' => $access,
    'callback' => 'panels_page_view_page',
    'callback arguments' => array(
      $page->name,
      TRUE,
    ),
    'weight' => -10,
    'type' => MENU_CALLBACK,
  );
  $items[] = array(
    'path' => $base . '/preview',
    'title' => t('Preview'),
    'access' => $access,
    'callback' => 'panels_page_view_page',
    'callback arguments' => array(
      $page->name,
      TRUE,
    ),
    'weight' => -10,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );

  // Set up for the 'default' display.
  $items[] = array(
    'path' => $base . '/edit/layout',
    'title' => t('Layout'),
    'access' => $access,
    'callback' => 'panels_page_passthru',
    'callback arguments' => array(
      'panels_page_edit_layout',
      $page->name,
    ),
    'weight' => -9,
    'type' => MENU_LOCAL_TASK,
  );
  $items[] = array(
    'path' => $base . '/edit/general',
    'title' => t('Settings'),
    'access' => $access,
    'callback' => 'panels_page_passthru',
    'callback arguments' => array(
      'panels_page_edit',
      $page->name,
    ),
    'weight' => -7,
    'type' => MENU_LOCAL_TASK,
  );
  $items[] = array(
    'path' => $base . '/edit/settings',
    'title' => t('Layout settings'),
    'access' => $access,
    'callback' => 'panels_page_passthru',
    'callback arguments' => array(
      'panels_page_edit_layout_settings',
      $page->name,
      NULL,
    ),
    'weight' => -5,
    'type' => MENU_LOCAL_TASK,
  );
  $items[] = array(
    'path' => $base . '/edit/advanced',
    'title' => t('Advanced'),
    'access' => $access,
    'callback' => 'panels_page_passthru',
    'callback arguments' => array(
      'panels_page_edit_advanced',
      $page->name,
    ),
    'weight' => -3,
    'type' => MENU_LOCAL_TASK,
  );
  $items[] = array(
    'path' => $base . '/edit/context',
    'title' => t('Context'),
    'access' => $access,
    'callback' => 'panels_page_passthru',
    'callback arguments' => array(
      'panels_page_edit_context',
      $page->name,
    ),
    'weight' => -2,
    'type' => MENU_LOCAL_TASK,
  );
  $items[] = array(
    'path' => $base . '/edit/content',
    'title' => t('Content'),
    'access' => $access,
    'callback' => 'panels_page_passthru',
    'callback arguments' => array(
      'panels_page_edit_content',
      $page->name,
    ),
    'weight' => -1,
    'type' => MENU_LOCAL_TASK,
  );
  $items[] = array(
    'path' => $base . '/edit/layout/default',
    'title' => t('Default'),
    'access' => $access,
    'callback' => 'panels_page_passthru',
    'callback arguments' => array(
      'panels_page_edit_layout',
      $page->name,
    ),
    'weight' => -1,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items[] = array(
    'path' => $base . '/edit/settings/default',
    'title' => t('Default'),
    'access' => $access,
    'callback' => 'panels_page_passthru',
    'callback arguments' => array(
      'panels_page_edit_layout_settings',
      $page->name,
      NULL,
    ),
    'weight' => -1,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items[] = array(
    'path' => $base . '/edit/content/default',
    'title' => t('Default'),
    'access' => $access,
    'callback' => 'panels_page_passthru',
    'callback arguments' => array(
      'panels_page_edit_content',
      $page->name,
    ),
    'weight' => -1,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  if (!empty($page->displays)) {
    foreach ($page->displays as $display_id => $info) {
      $items[] = array(
        'path' => $base . '/edit/layout/' . $display_id,
        'title' => $info['title'],
        'access' => $access,
        'callback' => 'panels_page_passthru',
        'callback arguments' => array(
          'panels_page_edit_layout',
          $page->name,
          $display_id,
        ),
        'type' => MENU_LOCAL_TASK,
      );
      $items[] = array(
        'path' => $base . '/edit/settings/' . $display_id,
        'title' => $info['title'],
        'access' => $access,
        'callback' => 'panels_page_passthru',
        'callback arguments' => array(
          'panels_page_edit_layout_settings',
          $page->name,
          $display_id,
        ),
        'type' => MENU_LOCAL_TASK,
      );
      $items[] = array(
        'path' => $base . '/edit/content/' . $display_id,
        'title' => $info['title'],
        'access' => $access,
        'callback' => 'panels_page_passthru',
        'callback arguments' => array(
          'panels_page_edit_content',
          $page->name,
          $display_id,
        ),
        'type' => MENU_LOCAL_TASK,
      );
    }
  }
  $items[] = array(
    'path' => $base . '/export',
    'title' => t('Export'),
    'access' => $access,
    'callback' => 'panels_page_passthru',
    'callback arguments' => array(
      'drupal_get_form',
      'panels_page_edit_export',
      $page->name,
    ),
    'weight' => 0,
    'type' => MENU_LOCAL_TASK,
  );
  $items[] = array(
    'path' => $base . '/delete',
    'title' => t('Delete panel page'),
    'access' => $access,
    'callback' => 'panels_page_passthru',
    'callback arguments' => array(
      'drupal_get_form',
      'panels_page_delete_confirm',
      $page->name,
    ),
    'type' => MENU_CALLBACK,
  );
}