1 views_ui.module views_ui_menu()

Implements hook_menu().

File

core/modules/views_ui/views_ui.module, line 11
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' => 'views_ui.admin.inc',
  );

  // Top-level Views module pages (not tied to a particular View).
  $items['admin/structure/views'] = array(
    'title' => 'Views',
    'description' => 'Manage customized lists of content.',
    'page callback' => 'views_ui_list_page',
    'type' => MENU_NORMAL_ITEM,
  ) + $base;
  $items['admin/structure/views/list'] = array(
    'title' => 'List views',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
  );

  $items['admin/structure/views/add'] = array(
    'title' => 'Add view',
    'page callback' => 'views_ui_add_page',
    'type' => MENU_LOCAL_ACTION,
  ) + $base;

  $items['admin/structure/views/settings'] = array(
    'title' => 'Settings',
    'page callback' => 'backdrop_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 Configure 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/configure'] = array(
    'title' => 'Configure 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/configure/%/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/clone'] = array(
    'title' => 'Clone view',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('views_ui_clone_form', 4),
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
  ) + $base;
  $items['admin/structure/views/view/%views_ui_cache/delete'] = array(
    'title' => 'Delete view',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('views_ui_delete_form', 4),
    'access callback' => 'views_ui_menu_action_access',
    'access arguments' => array(4, 'delete'),
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
  ) + $base;
  $items['admin/structure/views/view/%views_ui_cache/enable'] = array(
    'title' => 'Enable view',
    'page callback' => 'views_ui_toggle_enable_page',
    'page arguments' => array(4, '1'),
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
  ) + $base;
  $items['admin/structure/views/view/%views_ui_cache/disable'] = array(
    'title' => 'Disable view',
    'page callback' => 'views_ui_toggle_enable_page',
    'page arguments' => array(4, '0'),
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
  ) + $base;
  $items['admin/structure/views/view/%views_ui_cache/revert'] = array(
    'title' => 'Revert view',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('views_ui_revert_form', 4),
    'access callback' => 'views_ui_menu_action_access',
    'access arguments' => array(4, 'revert'),
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
  ) + $base;
  $items['admin/structure/views/view/%views_ui_cache/break-lock'] = array(
    'title' => 'Break lock',
    'page callback' => 'backdrop_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;

  // NoJS/AJAX callbacks that require custom page callbacks.
  $ajax_callbacks = array(
    'preview' => 'views_ui_preview',
  );
  foreach ($ajax_callbacks as $menu => $menu_callback) {
    $items['admin/structure/views/nojs/' . $menu . '/%views_ui_cache/%'] = array(
      'page callback' => $menu_callback,
      'page arguments' => array(5, 6),
    ) + $base;
    $items['admin/structure/views/ajax/' . $menu . '/%views_ui_cache/%'] = array(
      'page callback' => $menu_callback,
      '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',
    'delivery callback' => 'backdrop_json_deliver',
    'type' => MENU_CALLBACK,
  ) + $base;

  // A page in the Reports section to show usage of fields in all views
  if (module_exists('field_ui')) {
    $items['admin/reports/fields/list'] = array(
      'title' => 'List fields',
      '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;
}