You are here

public function SettingsForm::submitForm in The CodeMirror Editor 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 151

Class

SettingsForm
CodeMirror editor settings form.

Namespace

Drupal\codemirror_editor\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  $this
    ->config('codemirror_editor.settings')
    ->set('cdn', $values['cdn'])
    ->set('minified', $values['minified'])
    ->set('theme', $values['theme'])
    ->set('language_modes', array_values(array_filter($values['language_modes'])))
    ->save();

  // Invalidate discovery caches to rebuild asserts.
  $this->cacheTagsInvalidator
    ->invalidateTags([
    'library_info',
  ]);
  parent::submitForm($form, $form_state);
}