You are here

public function WebformDeterSettingsForm::submitForm in Webform Deter 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/WebformDeterSettingsForm.php, line 58

Class

WebformDeterSettingsForm
Form to configure Webform Deter settings.

Namespace

Drupal\webform_deter\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->cleanValues();
  $config = $this
    ->config('webform_deter.settings');
  $config
    ->set('warning_message', $form_state
    ->getValue('warning_message'));
  $patterns = explode("\n", $form_state
    ->getValue('patterns'));
  $patterns = array_map('trim', $patterns);
  $patterns = array_filter($patterns, 'strlen');
  $config
    ->set('patterns', $patterns);
  $config
    ->save();
  parent::submitForm($form, $form_state);
}