diff --git a/src/Form/ModuleConfigurationForm.php b/src/Form/ModuleConfigurationForm.php index 44dcda9edadb26993a7008e1b80fa679ac4d42ce..4dc7ce2a12fc2ae3c11f9bd6c01c1fdb0b760cf8 100644 --- a/src/Form/ModuleConfigurationForm.php +++ b/src/Form/ModuleConfigurationForm.php @@ -23,6 +23,7 @@ class ModuleConfigurationForm extends ConfigFormBase { protected function getEditableConfigNames() { return [ 'wcm8_siteinfo.settings', + 'system.site', ]; } @@ -58,11 +59,10 @@ class ModuleConfigurationForm extends ConfigFormBase { $form['basic']['site_name'] = array( '#type' => 'textfield', '#title' => $this->t('Site Name'), - '#description' => $this->t('READ ONLY for now until this app is done. Main name for the site - it should be your college, department or organization name.'), + '#description' => $this->t('Main name for the site - it should be your college, department or organization name.'), '#size' => '60', '#maxlength' => '75', '#default_value' => $site_name, - '#attributes' => array('readonly' => 'readonly'), ); $form['basic']['admin_link'] = array( @@ -220,6 +220,8 @@ class ModuleConfigurationForm extends ConfigFormBase { */ public function submitForm(array &$form, FormStateInterface $form_state) { $values = $form_state->getValues(); + + //set config values unique to this module $this->config('wcm8_siteinfo.settings') ->set('prefix', $values['prefix']) ->set('admin_link', $values['admin_link']) @@ -240,8 +242,12 @@ class ModuleConfigurationForm extends ConfigFormBase { ->set('instagram', $values['instagram']) ->set('photos', $values['photos']) ->save(); - + + //set site name value back to system.site + $this->configFactory->getEditable('system.site') + ->set('name', $values['site_name']) + ->save(); + parent::submitForm($form, $form_state); } - -} \ No newline at end of file +}