public SiteSettingsForm::submitForm(array &$form, FormStateInterface $form_state)
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
- core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php, line 212
Class
- SiteSettingsForm
- Provides a form to configure and rewrite settings.php.
Namespace
Drupal\Core\Installer\Form
Code
public function submitForm(array &$form, FormStateInterface $form_state) { global $install_state; // Update global settings array and save. $settings = array(); $database = $form_state->get('database'); $settings['databases']['default']['default'] = (object) array( 'value' => $database, 'required' => TRUE, ); $settings['settings']['hash_salt'] = (object) array( 'value' => Crypt::randomBytesBase64(55), 'required' => TRUE, ); // Remember the profile which was used. $settings['settings']['install_profile'] = (object) array( 'value' => $install_state['parameters']['profile'], 'required' => TRUE, ); drupal_rewrite_settings($settings); // Add the config directories to settings.php. drupal_install_config_directories(); // Indicate that the settings file has been verified, and check the database // for the last completed task, now that we have a valid connection. This // last step is important since we want to trigger an error if the new // database already has Drupal installed. $install_state['settings_verified'] = TRUE; $install_state['config_verified'] = TRUE; $install_state['database_verified'] = TRUE; $install_state['completed_task'] = install_verify_completed_task(); }
Please login to continue.