function SwitchUserForm::create

Same name in other branches
  1. 4.x src/Form/SwitchUserForm.php \Drupal\devel\Form\SwitchUserForm::create()

Overrides FormBase::create

File

src/Form/SwitchUserForm.php, line 30

Class

SwitchUserForm
Define a form to allow the user to switch and become another user.

Namespace

Drupal\devel\Form

Code

public static function create(ContainerInterface $container) : static {
    $instance = parent::create($container);
    $instance->csrfToken = $container->get('csrf_token');
    $instance->userStorage = $container->get('entity_type.manager')
        ->getStorage('user');
    $instance->stringTranslation = $container->get('string_translation');
    return $instance;
}