You are here

function views_menu_standard_items in Views (for Drupal 7) 5

Add the menu items for all non-inline views to the menu

1 call to views_menu_standard_items()
views_menu in ./views.module
Implementation of hook_menu()

File

./views.module, line 41

Code

function views_menu_standard_items(&$items) {
  $result = db_query("SELECT * FROM {view_view} WHERE page = 1");
  while ($view = db_fetch_object($result)) {

    // This happens before the next check; even if it's put off for later
    // it is still used.
    $used[$view->name] = true;

    // Skip views with inline arguments.
    if ($view->url[0] == '$' || strpos($view->url, '/$') !== FALSE) {
      continue;
    }

    // unpack the array
    $view->access = $view->access ? explode(', ', $view->access) : array();
    _views_create_menu_item($items, $view, $view->url);
  }
  $default_views = _views_get_default_views();
  $views_status = variable_get('views_defaults', array());

  // Process default views
  foreach ($default_views as $name => $view) {
    if ($view->page && !$used[$name] && ($views_status[$name] == 'enabled' || !$view->disabled && $views_status[$name] != 'disabled')) {

      // skip views with inline args
      if ($view->url[0] == '$' || strpos($view->url, '/$') !== FALSE) {
        continue;
      }
      _views_create_menu_item($items, $view, $view->url);
    }
  }
}