function views_set_current_view

Same name in other branches
  1. 9 core/modules/views/views.module \views_set_current_view()
  2. 8.9.x core/modules/views/views.module \views_set_current_view()
  3. 10 core/modules/views/views.module \views_set_current_view()

Set the current view.

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

Return value

\Drupal\views\ViewExecutable

3 calls to views_set_current_view()
ViewExecutable::postExecute in core/modules/views/src/ViewExecutable.php
Unsets the current view, mostly.
ViewExecutable::preExecute in core/modules/views/src/ViewExecutable.php
Runs attachments and lets the display do what it needs to before running.
views_get_current_view in core/modules/views/views.module
Find out what, if any, current view is currently in use.

File

core/modules/views/views.module, line 222

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.