function views_get_view

3.x views.module views_get_view($name, $reset = FALSE)
2.x views.module views_get_view($name, $reset = FALSE)

Get a view from the database or from default views.

This function is just a static wrapper around views::load(). This function isn't called 'views_load()' primarily because it might get a view from the default views which aren't technically loaded from the database.

Parameters

$name: The name of the view.

$reset: If TRUE, reset this entry in the load cache.

Return value

view A reference to the $view object. Use $reset if you're sure you want a fresh one.

10 calls to views_get_view()
views_ajax in includes/ajax.inc
Menu callback to load a view via AJAX.
views_arg_load in ./views.module
Helper function for menu loading. This will automatically be called in order to 'load' a views argument; primarily it will be used to perform validation.
views_block in ./views.module
Implementation of hook_block
views_embed_view in ./views.module
Embed a view using a PHP snippet.
views_get_view_result in ./views.module
Get the result of a view. *

... See full list

File

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

Code

function views_get_view($name, $reset = FALSE) {
  views_include('view');
  $view = view::load($name, $reset);
  $default_view = views_get_default_view($name);

  // The view does not exist.
  if (empty($view) && empty($default_view)) {
    return;
  }
  // The view is defined in code.
  elseif (empty($view) && !empty($default_view)) {
    $status = variable_get('views_defaults', array());
    if (isset($status[$default_view->name])) {
      $default_view->disabled = $status[$default_view->name];
    }
    $default_view->type = t('Default');
    return $default_view->clone_view();
  }
  // The view is overriden/defined in the database.
  elseif (!empty($view) && !empty($default_view)) {
    $view->type = t('Overridden');
  }

  return $view->clone_view();
}