public function SiteConfigureForm::submitForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php \Drupal\Core\Installer\Form\SiteConfigureForm::submitForm()
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 ConfigFormBase::submitForm
File
- core/
lib/ Drupal/ Core/ Installer/ Form/ SiteConfigureForm.php, line 264 - Contains \Drupal\Core\Installer\Form\SiteConfigureForm.
Class
- SiteConfigureForm
- Provides the site configuration form.
Namespace
Drupal\Core\Installer\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$this
->config('system.site')
->set('name', (string) $form_state
->getValue('site_name'))
->set('mail', (string) $form_state
->getValue('site_mail'))
->save(TRUE);
$this
->config('system.date')
->set('timezone.default', (string) $form_state
->getValue('date_default_timezone'))
->set('country.default', (string) $form_state
->getValue('site_default_country'))
->save(TRUE);
$account_values = $form_state
->getValue('account');
// Enable update.module if this option was selected.
$update_status_module = $form_state
->getValue('update_status_module');
if ($update_status_module[1]) {
$this->moduleInstaller
->install(array(
'file',
'update',
), FALSE);
// Add the site maintenance account's email address to the list of
// addresses to be notified when updates are available, if selected.
if ($update_status_module[2]) {
// Reset the configuration factory so it is updated with the new module.
$this
->resetConfigFactory();
$this
->config('update.settings')
->set('notification.emails', array(
$account_values['mail'],
))
->save(TRUE);
}
}
// 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']);
}