function ControllerBase::currentUser
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Controller/ControllerBase.php \Drupal\Core\Controller\ControllerBase::currentUser()
- 10 core/lib/Drupal/Core/Controller/ControllerBase.php \Drupal\Core\Controller\ControllerBase::currentUser()
- 9 core/lib/Drupal/Core/Controller/ControllerBase.php \Drupal\Core\Controller\ControllerBase::currentUser()
- 8.9.x 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.
6 calls to ControllerBase::currentUser()
- 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.
- NodeController::revisionShow in core/
modules/ node/ src/ Controller/ NodeController.php - Displays a node revision.
- TestContent::test11 in core/
modules/ system/ tests/ modules/ router_test_directory/ src/ TestContent.php - Provides example content for route specific authentication.
File
-
core/
lib/ Drupal/ Core/ Controller/ ControllerBase.php, line 236
Class
- ControllerBase
- Utility base class for thin controllers.
Namespace
Drupal\Core\ControllerCode
protected function currentUser() {
if (!$this->currentUser) {
$this->currentUser = $this->container()
->get('current_user');
}
return $this->currentUser;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.