You are here

public function HighlightSettingsForm::submitForm in Highlight 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/HighlightSettingsForm.php, line 98

Class

HighlightSettingsForm
Configure highlight settings for this site.

Namespace

Drupal\highlight\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->configFactory
    ->getEditable(static::SETTINGS)
    ->set('area', $form_state
    ->getValue('area'))
    ->set('class', $form_state
    ->getValue('class'))
    ->set('color', $form_state
    ->getValue('color'))
    ->set('text_color', $form_state
    ->getValue('text_color'))
    ->set('wordsonly', $form_state
    ->getValue('wordsonly'))
    ->set('patterns', explode("\n", $form_state
    ->getValue('patterns')))
    ->set('patterns_referrer', explode("\n", $form_state
    ->getValue('patterns_referrer')))
    ->set('stopwords', $form_state
    ->getValue('stopwords'))
    ->save();
  parent::submitForm($form, $form_state);
}