You are here

public function MathCaptchaSettingsForm::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

math_captcha/src/Form/MathCaptchaSettingsForm.php, line 182

Class

MathCaptchaSettingsForm
Math CAPTCHA settings form.

Namespace

Drupal\math_captcha\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('math_captcha.settings');
  $config
    ->set('math_captcha_enabled_challenges', $form_state
    ->getValue('math_captcha_enabled_challenges'));
  $config
    ->set('math_captcha_textual_numbers', $form_state
    ->getValue('math_captcha_textual_numbers'));
  $config
    ->set('math_captcha_textual_operators', $form_state
    ->getValue('math_captcha_textual_operators'));
  $config
    ->set('math_captcha_addition_argmax', $form_state
    ->getValue('math_captcha_addition_argmax'));
  $config
    ->set('math_captcha_addition_allow_negative', $form_state
    ->getValue('math_captcha_addition_allow_negative'));
  $config
    ->set('math_captcha_subtraction_argmax', $form_state
    ->getValue('math_captcha_subtraction_argmax'));
  $config
    ->set('math_captcha_subtraction_allow_negative', $form_state
    ->getValue('math_captcha_subtraction_allow_negative'));
  $config
    ->set('math_captcha_multiplication_argmax', $form_state
    ->getValue('math_captcha_multiplication_argmax'));
  $config
    ->set('math_captcha_multiplication_allow_negative', $form_state
    ->getValue('math_captcha_multiplication_allow_negative'));
  $config
    ->save();
  parent::submitForm($form, $form_state);
}