Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Form/FormBase.php \Drupal\Core\Form\FormBase::currentUser()
  2. 9 core/lib/Drupal/Core/Form/FormBase.php \Drupal\Core\Form\FormBase::currentUser()

Gets the current user.

Return value

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

21 calls to FormBase::currentUser()
BlockContentForm::actions in core/modules/block_content/src/BlockContentForm.php
Returns an array of supported actions for the current entity form.
BookOutlineForm::form in core/modules/book/src/Form/BookOutlineForm.php
Gets the actual form array to be built.
CommentAdminOverview::submitForm in core/modules/comment/src/Form/CommentAdminOverview.php
Form submission handler.
ContentEntityForm::buildEntity in core/lib/Drupal/Core/Entity/ContentEntityForm.php
Builds an updated entity object based upon the submitted form values.
ContentEntityForm::validateForm in core/lib/Drupal/Core/Entity/ContentEntityForm.php
Button-level validation handlers are highly discouraged for entity forms, as they will prevent entity validation from running. If the entity is going to be saved during the form submission, this method should be manually invoked from the button-level…

... See full list

File

core/lib/Drupal/Core/Form/FormBase.php, line 191

Class

FormBase
Provides a base class for forms.

Namespace

Drupal\Core\Form

Code

protected function currentUser() {
  return \Drupal::currentUser();
}