You are here

public function SiteConfigureForm::submitForm in Configuration installer 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Form/SiteConfigureForm.php, line 206

Class

SiteConfigureForm
Updates the user 1 account.

Namespace

Drupal\config_installer\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $account_values = $form_state
    ->getValue('account');

  // We precreated user 1 with placeholder values. Let's save the real values.
  $account = $this->userStorage
    ->load(1);
  $account->init = $account->mail = $account_values['mail'];
  $account->roles = $account
    ->getRoles();
  $account
    ->activate();
  $account->timezone = $form_state
    ->getValue('date_default_timezone');
  $account->pass = $account_values['pass'];
  $account->name = $account_values['name'];
  $account
    ->save();

  // Record when this install ran.
  $this->state
    ->set('install_time', $_SERVER['REQUEST_TIME']);
  if (version_compare(\Drupal::VERSION, '8.3', '>=')) {

    // We need to invalidate the container to ensure that the correct profile
    // is used on after installation.
    \Drupal::service('kernel')
      ->invalidateContainer();
  }
}