function SwitchUserPageForm::buildForm

Overrides FormInterface::buildForm

File

src/Form/SwitchUserPageForm.php, line 47

Class

SwitchUserPageForm
Define an accessible form to switch the user.

Namespace

Drupal\devel\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) : array {
    if ($accounts = $this->switchUserListHelper
        ->getUsers()) {
        $form['devel_links'] = $this->switchUserListHelper
            ->buildUserList($accounts);
        $form['devel_form'] = $this->formBuilder
            ->getForm(SwitchUserForm::class);
    }
    else {
        $this->messenger
            ->addStatus('There are no user accounts present!');
    }
    return $form;
}