You are here

public function EmailSpamspanFormatter::validateSettingsForm in SpamSpan filter 8

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

Validate settings form.

Overrides SpamspanSettingsFormTrait::validateSettingsForm

File

src/Plugin/Field/FieldFormatter/EmailSpamspanFormatter.php, line 60

Class

EmailSpamspanFormatter
Plugin implementation of the 'email_mailto' formatter.

Namespace

Drupal\spamspan\Plugin\Field\FieldFormatter

Code

public function validateSettingsForm(array &$form, FormStateInterface $form_state) {
  $field_name = $form_state
    ->get('plugin_settings_edit');
  $settings = $form_state
    ->getValue([
    'fields',
    $field_name,
    'settings_edit_form',
    '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([
    'fields',
    $field_name,
    'settings_edit_form',
    'settings',
  ], $settings);
}