You are here

public function LostCharacterCaptchaSettingsForm::submitForm in CAPTCHA Pack 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

text_captcha/modules/lost_character_captcha/src/Form/LostCharacterCaptchaSettingsForm.php, line 72

Class

LostCharacterCaptchaSettingsForm
Function for the settings form.

Namespace

Drupal\lost_character_captcha\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('lost_character_captcha.settings');
  $config
    ->set('lost_character_captcha_enable_hint', $form_state
    ->getValue('lost_character_captcha_enable_hint'))
    ->set('lost_character_captcha_quantity', $form_state
    ->getValue('lost_character_captcha_quantity'));
  foreach ($form_state
    ->getValues() as $label => $value) {
    if (strpos($label, 'lost_character_captcha_word_pool') !== FALSE) {
      $config
        ->set($label, $value);
    }
  }
  $config
    ->save();
  parent::SubmitForm($form, $form_state);
}