function FormBuilder::currentUser
Same name in other branches
- 9 core/lib/Drupal/Core/Form/FormBuilder.php \Drupal\Core\Form\FormBuilder::currentUser()
- 10 core/lib/Drupal/Core/Form/FormBuilder.php \Drupal\Core\Form\FormBuilder::currentUser()
- 11.x 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.
1 call to FormBuilder::currentUser()
- FormBuilder::prepareForm in core/
lib/ Drupal/ Core/ Form/ FormBuilder.php - Prepares a structured form array.
File
-
core/
lib/ Drupal/ Core/ Form/ FormBuilder.php, line 1407
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.