Same name and namespace in other branches
  1. 5.x-1.x views.module \views_set_current_view()
  2. 6.x-3.x views.module \views_set_current_view()

Set current view.

Set the current 'current view' that is being built/rendered so that it is easy for other modules or items in drupal_eval to identify.

Return value

view The current view.

3 calls to views_set_current_view()
view::post_execute in includes/view.inc
Unset the current view, mostly.
view::pre_execute in includes/view.inc
Run attachments and let the display do what it needs to do prior to running.
views_get_current_view in ./views.module
Get current view.

File

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

Code

function &views_set_current_view($view = NULL) {
  static $cache = NULL;
  if (isset($view)) {
    $cache = $view;
  }
  return $cache;
}