function views_set_current_view
Same name and namespace in other branches
- 11.x core/modules/views/views.module \views_set_current_view()
- 10 core/modules/views/views.module \views_set_current_view()
- 9 core/modules/views/views.module \views_set_current_view()
- 8.9.x 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|null|false The current view object, NULL if no view is set yet, or FALSE if the view was removed.
Deprecated
in drupal:11.4.0 and is removed from drupal:13.0.0. There is no replacement.
See also
https://www.drupal.org/node/3572594
File
-
core/
modules/ views/ views.module, line 190
Code
function &views_set_current_view($view = NULL) {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. There is no replacement. See https://www.drupal.org/node/3572594', E_USER_DEPRECATED);
if (isset($view)) {
$GLOBALS['_current_view'] = $view;
}
// @todo remove $GLOBALS['_current_view'] from ViewExecutable when this is
// removed. https://www.drupal.org/project/drupal/issues/3572671
$GLOBALS['_current_view'] ??= NULL;
return $GLOBALS['_current_view'];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.