You are here

protected function FormBuilder::currentUser in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Form/FormBuilder.php \Drupal\Core\Form\FormBuilder::currentUser()

Gets the current active user.

Return value

\Drupal\Core\Session\AccountInterface

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 1388
Contains \Drupal\Core\Form\FormBuilder.

Class

FormBuilder
Provides form building and processing.

Namespace

Drupal\Core\Form

Code

protected function currentUser() {
  if (!$this->currentUser && \Drupal::hasService('current_user')) {
    $this->currentUser = \Drupal::currentUser();
  }
  return $this->currentUser;
}