You are here

function views_ui_menu in Views (for Drupal 7) 5

Same name and namespace in other branches
  1. 8.3 views_ui/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()

File

./views_ui.module, line 90

Code

function views_ui_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/build/views',
      'title' => t('Views'),
      'callback' => 'views_ui_admin_page',
      'access' => user_access('administer views'),
      'description' => t('Views are customized lists of content on your system; they are highly configurable and give you control over how lists of content are presented.'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/build/views/list',
      'title' => t('List'),
      'callback' => 'views_ui_admin_page',
      'access' => user_access('administer views'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => '-1',
    );
    $items[] = array(
      'path' => 'admin/build/views/add',
      'title' => t('Add'),
      'callback' => 'views_ui_admin_add_page',
      'access' => user_access('administer views'),
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/build/views/import',
      'title' => t('Import'),
      'callback' => 'views_ui_admin_import_page',
      'access' => user_access('administer views') && user_access('use PHP for block visibility'),
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/build/views/tools',
      'title' => t('Tools'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'views_ui_admin_tools',
      ),
      'access' => user_access('administer views'),
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/build/views/delete',
      'title' => t('Edit view'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'views_ui_admin_delete_confirm',
      ),
      'access' => user_access('administer views'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/build/views/enable',
      'callback' => 'views_ui_admin_enable_page',
      'access' => user_access('administer views'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/build/views/disable',
      'callback' => 'views_ui_admin_disable_page',
      'access' => user_access('administer views'),
      'type' => MENU_CALLBACK,
    );
  }
  else {
    if (user_access('administer views') && arg(0) == 'admin' && arg(1) == 'build' && arg(2) == 'views') {
      $view = views_load_view(arg(3));
      if ($view) {
        views_ui_add_menu_items($items, $view, 'admin/build/views/' . arg(3), TRUE);
      }
    }
  }
  return $items;
}