You are here

function panels_menu in Panels 7.3

Same name and namespace in other branches
  1. 8.3 panels.module \panels_menu()
  2. 5.2 panels.module \panels_menu()
  3. 5 panels.module \panels_menu()
  4. 6.3 panels.module \panels_menu()
  5. 6.2 panels.module \panels_menu()

Implements hook_menu().

File

./panels.module, line 210
Core functionality for the Panels engine.

Code

function panels_menu() {

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

  // Base AJAX router callback.
  $items['panels/ajax'] = array(
    'access arguments' => array(
      'access content',
    ),
    'page callback' => 'panels_ajax_router',
    'theme callback' => 'ajax_base_page_theme',
    'delivery callback' => 'ajax_deliver',
    'type' => MENU_CALLBACK,
  );
  $admin_base = array(
    'file' => 'includes/callbacks.inc',
    'access arguments' => array(
      'use panels dashboard',
    ),
  );

  // Provide a nice location for a panels admin panel.
  $items['admin/structure/panels'] = array(
    'title' => 'Panels',
    'page callback' => 'panels_admin_page',
    'description' => 'Get a bird\'s eye view of items related to Panels.',
  ) + $admin_base;
  $items['admin/structure/panels/dashboard'] = array(
    'title' => 'Dashboard',
    'page callback' => 'panels_admin_page',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  ) + $admin_base;
  $items['admin/structure/panels/settings'] = array(
    'title' => 'Settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'panels_admin_settings_page',
    ),
    'type' => MENU_LOCAL_TASK,
  ) + $admin_base;
  $items['admin/structure/panels/settings/general'] = array(
    'title' => 'General',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'panels_admin_settings_page',
    ),
    'access arguments' => array(
      'administer page manager',
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  ) + $admin_base;
  if (module_exists('page_manager')) {
    $items['admin/structure/panels/settings/panel-page'] = array(
      'title' => 'Panel pages',
      'page callback' => 'panels_admin_panel_context_page',
      'type' => MENU_LOCAL_TASK,
      'weight' => -10,
    ) + $admin_base;
  }
  ctools_include('plugins', 'panels');
  $layouts = panels_get_layouts();
  foreach ($layouts as $name => $data) {
    if (!empty($data['hook menu'])) {
      if (is_array($data['hook menu'])) {
        $items += $data['hook menu'];
      }
      elseif (function_exists($data['hook menu'])) {
        $data['hook menu']($items, $data);
      }
    }
  }
  return $items;
}