You are here

public function StyleguideSettings::submitForm in Simple Style Guide 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/StyleguideSettings.php, line 84

Class

StyleguideSettings
Class StyleguideSettings.

Namespace

Drupal\simple_styleguide\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $config = $this
    ->config('simple_styleguide.styleguidesettings');
  $config
    ->set('default_patterns', $form_state
    ->getValue('default_patterns'));
  $config
    ->set('default_colors', explode("\r\n", $form_state
    ->getValue('default_colors')));
  $config
    ->save();
}