function views_get_default_view

2.x views.module &views_get_default_view($view_name)

Get a view from the default views defined by modules.

Default views are cached per-language. This function will rescan the default_views hook if necessary.

Parameters

$view_name: The name of the view to load.

Return value

A view object or NULL if it is not available.

1 call to views_get_default_view()
views_get_view in ./views.module
Get a view from the database or from default views.

File

./views.module, line 750
Primarily Drupal hooks and global API functions to manipulate views.

Code

function &views_get_default_view($view_name) {
  $null = NULL;

  // Attempt to load individually cached view from cache.
  views_include('cache');
  $data = views_cache_get("views_default:{$view_name}", TRUE);
  if (isset($data->data) && is_object($data->data)) {
    return $data->data;
  }

  // Otherwise, allow entire cache to be rebuilt.
  $cache = views_discover_default_views();
  if (isset($cache[$view_name])) {
    return $cache[$view_name];
  }
  return $null;
}