You are here

public function SettingsForm::submitForm in Siteimprove 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/SettingsForm.php, line 371

Class

SettingsForm
Siteimprove settings.

Namespace

Drupal\siteimprove\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $domain_plugin = $form_state
    ->getValue('domain_plugin');
  $this
    ->config('siteimprove.settings')
    ->set('token', $form_state
    ->getValue('token'))
    ->set('domain_plugin_id', $domain_plugin)
    ->set('prepublish_enabled', $form_state
    ->getValue('prepublish_enabled'))
    ->set('api_username', $form_state
    ->getValue('api_username'))
    ->set('api_key', $form_state
    ->getValue('api_key'))
    ->set('enabled_content_types', $form_state
    ->getValue('enabled_content_types'))
    ->set('enabled_taxonomies', $form_state
    ->getValue('enabled_taxonomies'))
    ->save();
  $plugin = $this->pluginManagerSiteimproveDomain
    ->createInstance($domain_plugin);
  $plugin
    ->submitForm($form, $form_state);
}