function views_get_current_view
Same name and namespace in other branches
- 11.x core/modules/views/views.module \views_get_current_view()
- 10 core/modules/views/views.module \views_get_current_view()
- 9 core/modules/views/views.module \views_get_current_view()
- 8.9.x core/modules/views/views.module \views_get_current_view()
Find out what, if any, current view is currently in use.
Note that this returns a reference, so be careful! You can unintentionally modify the $view object.
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 217
Code
function &views_get_current_view() {
@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);
// @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.