function ViewExecutable::getUser

Same name in other branches
  1. 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getUser()
  2. 8.9.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getUser()
  3. 11.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getUser()

Gets the current user.

Views plugins can receive the current user in order to not need dependency injection.

Return value

\Drupal\Core\Session\AccountInterface The current user.

File

core/modules/views/src/ViewExecutable.php, line 2094

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

public function getUser() {
    return $this->user;
}

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