Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Controller/ControllerBase.php \Drupal\Core\Controller\ControllerBase::currentUser()
  2. 9 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.

16 calls to ControllerBase::currentUser()
CommentController::getReplyForm in core/modules/comment/src/Controller/CommentController.php
Form constructor for the comment reply form.
CommentController::renderNewCommentsNodeLinks in core/modules/comment/src/Controller/CommentController.php
Returns a set of nodes' last read timestamps.
CommentController::replyFormAccess in core/modules/comment/src/Controller/CommentController.php
Access check for the reply form.
ContactController::contactSitePage in core/modules/contact/src/Controller/ContactController.php
Presents the site-wide contact form.
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 232

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