You are here

public function CleantalkSettingsForm::submitForm in Anti Spam by CleanTalk 8.3

Same name and namespace in other branches
  1. 8.4 src/Form/CleantalkSettingsForm.php \Drupal\cleantalk\Form\CleantalkSettingsForm::submitForm()
  2. 8 src/Form/CleantalkSettingsForm.php \Drupal\cleantalk\Form\CleantalkSettingsForm::submitForm()
  3. 9.1.x src/Form/CleantalkSettingsForm.php \Drupal\cleantalk\Form\CleantalkSettingsForm::submitForm()

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/CleantalkSettingsForm.php, line 30

Class

CleantalkSettingsForm

Namespace

Drupal\cleantalk\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('cleantalk.settings');
  $config_values = $form_state
    ->getValues();
  foreach ($config_values as $key => $value) {
    if (strpos($key, 'cleantalk') !== FALSE) {
      $config
        ->set($key, $value);
    }
  }
  $config
    ->save();
  if (method_exists($this, '_submitForm')) {
    $this
      ->_submitForm($form, $form_state);
  }
  parent::submitForm($form, $form_state);
}