You are here

public function SpamspanSettingsFormTrait::validateSettingsForm in SpamSpan filter 8

Same name and namespace in other branches
  1. 8.2 src/SpamspanSettingsFormTrait.php \Drupal\spamspan\SpamspanSettingsFormTrait::validateSettingsForm()

Validate settings form.

1 method overrides SpamspanSettingsFormTrait::validateSettingsForm()
EmailSpamspanFormatter::validateSettingsForm in src/Plugin/Field/FieldFormatter/EmailSpamspanFormatter.php
Validate settings form.

File

src/SpamspanSettingsFormTrait.php, line 125

Class

SpamspanSettingsFormTrait
Provides a common Settings form for Spamspan plugins.

Namespace

Drupal\spamspan

Code

public function validateSettingsForm(array &$form, FormStateInterface $form_state) {
  $settings = $form_state
    ->getValue([
    'filters',
    'filter_spamspan',
    'settings',
  ]);
  $use_form = $settings['use_form'];

  // No trees, see https://www.drupal.org/node/2378437.
  unset($settings['use_form']);
  $settings += $use_form;
  $form_state
    ->setValue([
    'filters',
    'filter_spamspan',
    'settings',
  ], $settings);
}