protected function ControllerBase::currentUser

protected ControllerBase::currentUser()

Returns the current user.

Return value

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

File

core/lib/Drupal/Core/Controller/ControllerBase.php, line 267

Class

ControllerBase
Utility base class for thin controllers.

Namespace

Drupal\Core\Controller

Code

protected function currentUser() {
  if (!$this->currentUser) {
    $this->currentUser = $this->container()->get('current_user');
  }
  return $this->currentUser;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Controller!ControllerBase.php/function/ControllerBase::currentUser/8.1.x