You are here

function panelizer_menu in Panelizer 7

Same name and namespace in other branches
  1. 6 panelizer.module \panelizer_menu()
  2. 7.3 panelizer.module \panelizer_menu()
  3. 7.2 panelizer.module \panelizer_menu()

Implements hook_menu().

File

./panelizer.module, line 38
panelize.module

Code

function panelizer_menu() {

  // Safety: go away if CTools is not at an appropriate version.
  if (!defined('PANELS_REQUIRED_CTOOLS_API') || !module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
    return array();
  }

  // Configure settings pages.
  $settings_base = array(
    'access arguments' => array(
      'administer panelizer',
    ),
    'file' => 'includes/admin.inc',
  );
  $items['admin/config/content/panelizer'] = array(
    'title' => 'Panelizer',
    'description' => 'Configure panelizer availability and defaults',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'panelizer_settings_page_form',
    ),
    'type' => MENU_NORMAL_ITEM,
  ) + $settings_base;
  $items['admin/config/content/panelizer/%/%'] = array(
    'title callback' => 'panelizer_default_title_callback',
    'title arguments' => array(
      4,
      5,
    ),
    'page callback' => 'panelizer_allowed_content_page',
    'page arguments' => array(
      4,
      5,
    ),
    'type' => MENU_CALLBACK,
  ) + $settings_base;
  $items['admin/config/content/panelizer/%/%/allowed'] = array(
    'title' => 'Available content',
    'page callback' => 'panelizer_allowed_content_page',
    'page arguments' => array(
      4,
      5,
    ),
    'type' => MENU_NORMAL_ITEM,
    'weight' => -10,
  ) + $settings_base;
  $items['admin/config/content/panelizer/%/%/list'] = array(
    'title' => 'List defaults',
    'access callback' => 'panelizer_has_choice_callback',
    'access arguments' => array(
      4,
      5,
      '',
    ),
    'page callback' => 'panelizer_default_list_page',
    'page arguments' => array(
      4,
      5,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => -6,
  ) + $settings_base;
  $tabs_base = array(
    'access callback' => 'panelizer_has_no_choice_callback',
    'access arguments' => array(
      4,
      5,
    ),
    'page arguments' => array(
      4,
      5,
      'default',
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/admin.inc',
  );
  $items['admin/config/content/panelizer/%/%/settings'] = array(
    'title' => 'Settings',
    'page callback' => 'panelizer_default_settings_page',
    'weight' => -5,
  ) + $tabs_base;
  $items['admin/config/content/panelizer/%/%/context'] = array(
    'title' => 'Contexts',
    'page callback' => 'panelizer_default_context_page',
    'weight' => -4,
  ) + $tabs_base;
  $items['admin/config/content/panelizer/%/%/layout'] = array(
    'title' => 'Layout',
    'page callback' => 'panelizer_default_layout_page',
    'weight' => -3,
  ) + $tabs_base;
  $items['admin/config/content/panelizer/%/%/content'] = array(
    'title' => 'Content',
    'page callback' => 'panelizer_default_content_page',
    'weight' => -2,
  ) + $tabs_base;
  $subtabs_base = array(
    'access callback' => 'panelizer_has_choice_callback',
    'access arguments' => array(
      4,
      5,
      6,
    ),
    'page arguments' => array(
      4,
      5,
      6,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/admin.inc',
  );
  $items['admin/config/content/panelizer/%/%/%'] = array(
    'title' => 'Settings',
    'page callback' => 'panelizer_default_settings_page',
    'title callback' => 'panelizer_default_name_title_callback',
    'type' => MENU_CALLBACK,
  ) + $subtabs_base;
  $items['admin/config/content/panelizer/%/%/%/settings'] = array(
    'title' => 'Settings',
    'page callback' => 'panelizer_default_settings_page',
    'type' => MENU_NORMAL_ITEM,
    'weight' => -5,
  ) + $subtabs_base;
  $items['admin/config/content/panelizer/%/%/%/context'] = array(
    'title' => 'Contexts',
    'page callback' => 'panelizer_default_context_page',
    'weight' => -4,
  ) + $subtabs_base;
  $items['admin/config/content/panelizer/%/%/%/layout'] = array(
    'title' => 'Layout',
    'page callback' => 'panelizer_default_layout_page',
    'weight' => -3,
  ) + $subtabs_base;
  $items['admin/config/content/panelizer/%/%/%/content'] = array(
    'title' => 'Content',
    'page callback' => 'panelizer_default_content_page',
    'weight' => -2,
  ) + $subtabs_base;

  // Configure node editing pages
  $base = array(
    'access callback' => 'panelizer_edit_node_callback',
    'access arguments' => array(
      1,
    ),
    'page arguments' => array(
      1,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/node.inc',
  );
  $items['node/%node/panelizer'] = array(
    'title' => 'Panelizer',
    // make sure this is accessible to panelize nodes with no defaults.
    'access arguments' => array(
      1,
      FALSE,
    ),
    'page callback' => 'panelizer_edit_node_settings_page',
    'weight' => 11,
  ) + $base;
  $items['node/%node/panelizer/settings'] = array(
    'title' => 'Settings',
    'page callback' => 'panelizer_edit_node_settings_page',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 11,
  ) + $base;
  $items['node/%node/panelizer/context'] = array(
    'title' => 'Context',
    'page callback' => 'panelizer_edit_node_context_page',
    'weight' => 12,
  ) + $base;
  $items['node/%node/panelizer/layout'] = array(
    'title' => 'Layout',
    'page callback' => 'panelizer_edit_node_layout_page',
    'weight' => 13,
  ) + $base;
  $items['node/%node/panelizer/content'] = array(
    'title' => 'Content',
    'page callback' => 'panelizer_edit_node_content_page',
    'weight' => 14,
  ) + $base;
  return $items;
}