function SiteSettingsForm::validateForm

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

Overrides FormBase::validateForm

File

core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php, line 154

Class

SiteSettingsForm
Provides a form to configure and rewrite settings.php.

Namespace

Drupal\Core\Installer\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
    // Make sure the install API is available.
    include_once DRUPAL_ROOT . '/core/includes/install.inc';
    $driver = $form_state->getValue('driver');
    $database = $form_state->getValue($driver);
    $database['driver'] = $driver;
    $database = array_merge($database, $this->databaseDriverList
        ->get($driver)
        ->getAutoloadInfo());
    $form_state->set('database', $database);
    foreach ($this->getDatabaseErrors($database, $form_state->getValue('settings_file')) as $name => $message) {
        $form_state->setErrorByName($name, $message);
    }
}

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