You are here

function panels_menu in Panels 8.3

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

Implementation of hook_menu

File

./panels.module, line 106
panels.module

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',
    ),
  );
  $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'];
      }
      else {
        if (function_exists($data['hook menu'])) {
          $data['hook menu']($items, $data);
        }
      }
    }
  }
  return $items;
}