FormBuilder::currentUser

protected FormBuilder::currentUser()

Gets the current active user.

Return value

\Drupal\Core\Session\AccountInterface

File

core/lib/Drupal/Core/Form/FormBuilder.php, line 1385

Class

FormBuilder
Provides form building and processing.

Namespace

Drupal\Core\Form

Code

1
2
3
4
5
6
protected function currentUser() {
  if (!$this->currentUser && \Drupal::hasService('current_user')) {
    $this->currentUser = \Drupal::currentUser();
  }
  return $this->currentUser;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.