You are here

protected function ControllerBase::currentUser in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Controller/ControllerBase.php \Drupal\Core\Controller\ControllerBase::currentUser()
  2. 10 core/lib/Drupal/Core/Controller/ControllerBase.php \Drupal\Core\Controller\ControllerBase::currentUser()

Returns the current user.

Return value

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

12 calls to ControllerBase::currentUser()
CommentController::getReplyForm in core/modules/comment/src/Controller/CommentController.php
Form constructor for the comment reply form.
CommentController::replyFormAccess in core/modules/comment/src/Controller/CommentController.php
Access check for the reply form.
ContentTranslationController::overview in core/modules/content_translation/src/Controller/ContentTranslationController.php
Builds the translations overview page.
DbUpdateController::selection in core/modules/system/src/Controller/DbUpdateController.php
Renders a list of available database updates.
FormTestController::twoFormInstances in core/modules/system/tests/modules/form_test/src/Controller/FormTestController.php
Returns two instances of the node form.

... See full list

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;
}