You are here

public function DomainConfigSettingsForm::submitForm in Domain Site Settings 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 ConfigFormBase::submitForm

File

src/Form/DomainConfigSettingsForm.php, line 216

Class

DomainConfigSettingsForm
Save domain config settings.

Namespace

Drupal\domain_site_settings\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $domain_id = $form_state
    ->getValue('domain_id');
  $site_name = $form_state
    ->getValue('site_name');
  $site_slogan = $form_state
    ->getValue('site_slogan');
  $site_mail = $form_state
    ->getValue('site_mail');
  $site_frontpage = $form_state
    ->getValue('site_frontpage');
  $site_403 = $form_state
    ->getValue('site_403');
  $site_404 = $form_state
    ->getValue('site_404');
  $config = $this
    ->config('domain_site_settings.domainconfigsettings');
  $config
    ->set($domain_id . '.site_name', $site_name);
  $config
    ->set($domain_id . '.site_slogan', $site_slogan);
  $config
    ->set($domain_id . '.site_mail', $site_mail);
  $config
    ->set($domain_id . '.site_frontpage', $site_frontpage);
  $config
    ->set($domain_id . '.site_403', $site_403);
  $config
    ->set($domain_id . '.site_404', $site_404);
  $config
    ->save();
}