You are here

protected function ControllerBase::currentUser in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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.

9 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.
FormTestController::twoFormInstances in core/modules/system/tests/modules/form_test/src/Controller/FormTestController.php
Returns two instances of the node form.
ForumController::buildActionLinks in core/modules/forum/src/Controller/ForumController.php
Generates an action link to display at the top of the forum listing.

... See full list

File

core/lib/Drupal/Core/Controller/ControllerBase.php, line 265
Contains \Drupal\Core\Controller\ControllerBase.

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