function SiteConfigureForm::validateForm

Same name in other branches
  1. 9 core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php \Drupal\Core\Installer\Form\SiteConfigureForm::validateForm()
  2. 8.9.x core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php \Drupal\Core\Installer\Form\SiteConfigureForm::validateForm()
  3. 10 core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php \Drupal\Core\Installer\Form\SiteConfigureForm::validateForm()

Overrides ConfigFormBase::validateForm

File

core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php, line 224

Class

SiteConfigureForm
Provides the site configuration form.

Namespace

Drupal\Core\Installer\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
    $violations = $this->userNameValidator
        ->validateName($form_state->getValue([
        'account',
        'name',
    ]));
    if ($violations->count() > 0) {
        $form_state->setErrorByName('account][name', $violations[0]->getMessage());
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.