public function CaptchaSettingsForm::submitForm in CAPTCHA 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
- src/
Form/ CaptchaSettingsForm.php, line 242
Class
- CaptchaSettingsForm
- Displays the captcha settings form.
Namespace
Drupal\captcha\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->config('captcha.settings');
$config
->set('administration_mode', $form_state
->getValue('administration_mode'));
$config
->set('allow_on_admin_pages', $form_state
->getValue('allow_on_admin_pages'));
$config
->set('default_challenge', $form_state
->getValue('default_challenge'));
$config
->set('enabled_default', $form_state
->getValue('enabled_default'));
// CAPTCHA description stuff.
$config
->set('add_captcha_description', $form_state
->getValue('add_captcha_description'));
// Save (or reset) the CAPTCHA descriptions.
$config
->set('description', $form_state
->getValue('description'));
$config
->set('wrong_captcha_response_message', $form_state
->getValue('wrong_captcha_response_message'));
$config
->set('default_validation', $form_state
->getValue('default_validation'));
$config
->set('persistence', $form_state
->getValue('persistence'));
$config
->set('enable_stats', $form_state
->getValue('enable_stats'));
$config
->set('log_wrong_responses', $form_state
->getValue('log_wrong_responses'));
$config
->save();
$this
->messenger()
->addStatus($this
->t('The CAPTCHA settings have been saved.'));
parent::submitForm($form, $form_state);
}