You are here

function views_ui_menu in Views (for Drupal 7) 8.3

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

Implements hook_menu().

File

views_ui/views_ui.module, line 17
Provide structure for the administrative interface to Views.

Code

function views_ui_menu() {
  $items = array();

  // Minor code reduction technique.
  $base = array(
    'access callback' => 'user_access',
    'access arguments' => array(
      'administer views',
    ),
    'file' => 'admin.inc',
  );

  // Set up the base for AJAX callbacks.
  $ajax_base = array(
    'page callback' => 'views_ui_ajax_callback',
    'page arguments' => array(
      4,
      5,
    ),
    'type' => MENU_CALLBACK,
  ) + $base;

  // Top-level Views module pages (not tied to a particular View).
  $items['admin/structure/views/add'] = array(
    'title' => 'Add new view',
    'page callback' => 'views_ui_add_page',
    'type' => MENU_LOCAL_ACTION,
  ) + $base;
  $items['admin/structure/views'] = array(
    'title' => 'Views',
    'description' => 'Manage customized lists of content.',
    'page callback' => 'views_ui_list_page',
  ) + $base;
  $items['admin/structure/views/list'] = array(
    'title' => 'List',
    'weight' => -10,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  ) + $base;
  $items['admin/structure/views/view/%views_ui/enable'] = array(
    'title' => 'Enable a view',
  ) + $ajax_base;
  $items['admin/structure/views/view/%views_ui/disable'] = array(
    'title' => 'Disable a view',
  ) + $ajax_base;
  $items['admin/structure/views/settings'] = array(
    'title' => 'Settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'views_ui_admin_settings_basic',
    ),
    'type' => MENU_LOCAL_TASK,
  ) + $base;
  $items['admin/structure/views/settings/basic'] = array(
    'title' => 'Basic',
    'page arguments' => array(
      'views_ui_admin_settings_basic',
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
  ) + $base;
  $items['admin/structure/views/settings/advanced'] = array(
    'title' => 'Advanced',
    'page arguments' => array(
      'views_ui_admin_settings_advanced',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 1,
  ) + $base;

  // The primary Edit View page. Secondary tabs for each Display are added in
  // views_ui_menu_local_tasks_alter().
  $items['admin/structure/views/view/%views_ui_cache'] = array(
    'title callback' => 'views_ui_edit_page_title',
    'title arguments' => array(
      4,
    ),
    'page callback' => 'views_ui_edit_page',
    'page arguments' => array(
      4,
    ),
  ) + $base;
  $items['admin/structure/views/view/%views_ui_cache/edit'] = array(
    'title' => 'Edit view',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    'weight' => -10,
    'theme callback' => 'ajax_base_page_theme',
  ) + $base;
  $items['admin/structure/views/view/%views_ui_cache/edit/%/ajax'] = array(
    'page callback' => 'views_ui_ajax_get_form',
    'page arguments' => array(
      'views_ui_edit_form',
      4,
      6,
    ),
    'delivery callback' => 'ajax_deliver',
    'theme callback' => 'ajax_base_page_theme',
    'type' => MENU_CALLBACK,
  ) + $base;
  $items['admin/structure/views/view/%views_ui_cache/preview/%'] = array(
    'page callback' => 'views_ui_build_preview',
    'page arguments' => array(
      4,
      6,
    ),
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
  ) + $base;
  $items['admin/structure/views/view/%views_ui_cache/preview/%/ajax'] = array(
    'page callback' => 'views_ui_build_preview',
    'page arguments' => array(
      4,
      6,
    ),
    'delivery callback' => 'ajax_deliver',
    'theme callback' => 'ajax_base_page_theme',
    'type' => MENU_CALLBACK,
  ) + $base;

  // Additional pages for acting on a View.
  $items['admin/structure/views/view/%views_ui_cache/break-lock'] = array(
    'title' => 'Break lock',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'views_ui_break_lock_confirm',
      4,
    ),
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
  ) + $base;

  // NoJS/AJAX callbacks that can use the default Views AJAX form system.
  $items['admin/structure/views/nojs/%/%views_ui_cache'] = array(
    'page callback' => 'views_ui_ajax_form',
    'page arguments' => array(
      FALSE,
      4,
      5,
    ),
    'type' => MENU_CALLBACK,
  ) + $base;
  $items['admin/structure/views/ajax/%/%views_ui_cache'] = array(
    'page callback' => 'views_ui_ajax_form',
    'page arguments' => array(
      TRUE,
      4,
      5,
    ),
    'delivery callback' => 'ajax_deliver',
    'type' => MENU_CALLBACK,
  ) + $base;
  $items['admin/structure/views/nojs/preview/%views_ui_cache/%'] = array(
    'page callback' => 'views_ui_preview',
    'page arguments' => array(
      5,
      6,
    ),
  ) + $base;
  $items['admin/structure/views/ajax/preview/%views_ui_cache/%'] = array(
    'page callback' => 'views_ui_preview',
    'page arguments' => array(
      5,
      6,
    ),
    'delivery callback' => 'ajax_deliver',
  ) + $base;

  // Autocomplete callback for tagging a View.
  // Views module uses admin/views/... instead of admin/structure/views/... for
  // autocomplete paths, so be consistent with that.
  // @todo Change to admin/structure/views/... when the change can be made to
  //   Views module as well.
  $items['admin/views/ajax/autocomplete/tag'] = array(
    'page callback' => 'views_ui_autocomplete_tag',
    'type' => MENU_CALLBACK,
  ) + $base;

  // A page in the Reports section to show usage of fields in all views
  $items['admin/reports/fields/list'] = array(
    'title' => 'List',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['admin/reports/fields/views-fields'] = array(
    'title' => 'Used in views',
    'description' => 'Overview of fields used in all views.',
    'page callback' => 'views_ui_field_list',
    'type' => MENU_LOCAL_TASK,
    'weight' => 0,
  ) + $base;

  // A page in the Reports section to show usage of plugins in all views.
  $items['admin/reports/views-plugins'] = array(
    'title' => 'Views plugins',
    'description' => 'Overview of plugins used in all views.',
    'page callback' => 'views_ui_plugin_list',
  ) + $base;
  return $items;
}