protected function FormBuilder::currentUser in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Form/FormBuilder.php \Drupal\Core\Form\FormBuilder::currentUser()
- 9 core/lib/Drupal/Core/Form/FormBuilder.php \Drupal\Core\Form\FormBuilder::currentUser()
Gets the current active user.
Return value
\Drupal\Core\Session\AccountInterface The current account.
File
- core/
lib/ Drupal/ Core/ Form/ FormBuilder.php, line 1411
Class
- FormBuilder
- Provides form building and processing.
Namespace
Drupal\Core\FormCode
protected function currentUser() {
if (!$this->currentUser && \Drupal::hasService('current_user')) {
$this->currentUser = \Drupal::currentUser();
}
return $this->currentUser;
}