function views_ui_menu

Implements hook_menu().

File

./views_ui.module, line 34

Code

function views_ui_menu() {
    $items = array();
    // Minor code reduction technique.
    $base = array(
        'access callback' => 'user_access',
        'access arguments' => array(
            'administer views',
        ),
        'file' => 'includes/admin.inc',
    );
    // 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;
    // Top-level Views module pages (not tied to a particular View).
    $items['admin/structure/views/add-template'] = array(
        'title' => 'Add view from template',
        'page callback' => 'views_ui_add_template_page',
        // Don't show a local action link if there aren't any templates.
'type' => views_get_all_templates() ? MENU_LOCAL_ACTION : MENU_VISIBLE_IN_BREADCRUMB,
    ) + $base;
    $items['admin/structure/views/import'] = array(
        'title' => 'Import',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
            'views_ui_import_page',
        ),
        'access callback' => 'views_import_access',
        'type' => MENU_LOCAL_ACTION,
    ) + $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;
    // 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',
        '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;
}