diff --git a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php index 0f1f25bb91..739d617741 100644 --- a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php +++ b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php @@ -67,6 +67,8 @@ public function getFormId() { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { + // Make sure the install API is available. + include_once DRUPAL_ROOT . '/core/includes/install.inc'; $settings_file = './' . $this->sitePath . '/settings.php'; $form['#title'] = $this->t('Database configuration'); @@ -155,6 +157,9 @@ public function buildForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ 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); $drivers = drupal_get_database_types(); @@ -236,6 +241,9 @@ public static function getDatabaseErrorsTemplate(array $errors) { public function submitForm(array &$form, FormStateInterface $form_state) { global $install_state; + // Make sure the install API is available. + include_once DRUPAL_ROOT . '/core/includes/install.inc'; + // Update global settings array and save. $settings = []; $database = $form_state->get('database'); diff --git a/core/modules/system/tests/modules/install_form_test/install_form_test.info.yml b/core/modules/system/tests/modules/install_form_test/install_form_test.info.yml new file mode 100644 index 0000000000..fb0457d495 --- /dev/null +++ b/core/modules/system/tests/modules/install_form_test/install_form_test.info.yml @@ -0,0 +1,5 @@ +name: Install Form Test +type: module +description: Test the SiteSettingsForm can be extended. +package: Testing +version: VERSION diff --git a/core/modules/system/tests/modules/install_form_test/install_form_test.routing.yml b/core/modules/system/tests/modules/install_form_test/install_form_test.routing.yml new file mode 100644 index 0000000000..9d5ec44479 --- /dev/null +++ b/core/modules/system/tests/modules/install_form_test/install_form_test.routing.yml @@ -0,0 +1,7 @@ +install_form_test.test-form: + path: /test-form + defaults: + _form: \Drupal\install_form_test\Form\ExtendedForm + _title: Extended Site Settings Form + requirements: + _access: 'TRUE' diff --git a/core/modules/system/tests/modules/install_form_test/src/Form/ExtendedForm.php b/core/modules/system/tests/modules/install_form_test/src/Form/ExtendedForm.php new file mode 100644 index 0000000000..613519ead3 --- /dev/null +++ b/core/modules/system/tests/modules/install_form_test/src/Form/ExtendedForm.php @@ -0,0 +1,11 @@ +drupalGet('test-form'); + $this->assertSession()->statusCodeEquals(200); + } + +}