You are here

function views_ui_add_menu_items in Views (for Drupal 7) 5

2 calls to views_ui_add_menu_items()
views_menu_admin_items in ./views.module
Add the adminstrative items to a view.
views_ui_menu in ./views_ui.module

File

./views_ui.module, line 151

Code

function views_ui_add_menu_items(&$items, $view, $url, $base = TRUE, $args = array()) {
  if (user_access('administer views')) {
    if ($base) {

      // we also have to add the administrative 'view' of the view in some
      // cases
      $items[] = array(
        'path' => $url,
        'title' => t('View'),
        'callback' => 'views_view_page',
        'callback arguments' => array_merge(array(
          $view->name,
        ), $args),
        'access' => user_access('administer views'),
        'type' => MENU_CALLBACK,
      );
    }
    $items[] = array(
      'path' => "{$url}/view",
      'title' => t('View'),
      'callback' => 'views_page',
      'callback arguments' => array_merge(array(
        $view->name,
      ), $args),
      'access' => user_access('administer views'),
      'weight' => -10,
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    if (isset($view->is_default)) {
      $items[] = array(
        'path' => "{$url}/add",
        'title' => t('Override'),
        'callback' => 'views_ui_admin_add_page',
        'callback arguments' => array(
          $view->name,
        ),
        'access' => user_access('administer views'),
        'weight' => -5,
        'type' => MENU_LOCAL_TASK,
      );
    }
    else {
      $items[] = array(
        'path' => "{$url}/edit",
        'title' => t('Edit'),
        'callback' => 'views_ui_admin_edit_page',
        'callback arguments' => array(
          $view->name,
        ),
        'access' => user_access('administer views'),
        'weight' => -5,
        'type' => MENU_LOCAL_TASK,
      );
    }
    $items[] = array(
      'path' => "{$url}/export",
      'title' => t('Export'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'views_ui_admin_export_page',
        $view->name,
      ),
      'access' => user_access('administer views'),
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => "{$url}/clone",
      'title' => t('Clone'),
      'callback' => 'views_ui_admin_clone_page',
      'callback arguments' => array(
        $view->name,
      ),
      'access' => user_access('administer views'),
      'type' => MENU_LOCAL_TASK,
    );
  }
}