You are here

public function PhraseCaptchaSettingsForm::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/phrase_captcha/src/Form/PhraseCaptchaSettingsForm.php, line 89

Class

PhraseCaptchaSettingsForm
Administration form.

Namespace

Drupal\phrase_captcha\Form

Code

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