You are here

public function ReCaptchaAdminSettingsForm::submitForm in reCAPTCHA 8.2

Same name and namespace in other branches
  1. 8.3 src/Form/ReCaptchaAdminSettingsForm.php \Drupal\recaptcha\Form\ReCaptchaAdminSettingsForm::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/ReCaptchaAdminSettingsForm.php, line 129

Class

ReCaptchaAdminSettingsForm
Configure reCAPTCHA settings for this site.

Namespace

Drupal\recaptcha\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('recaptcha.settings');
  $config
    ->set('site_key', $form_state
    ->getValue('recaptcha_site_key'))
    ->set('secret_key', $form_state
    ->getValue('recaptcha_secret_key'))
    ->set('verify_hostname', $form_state
    ->getValue('recaptcha_verify_hostname'))
    ->set('use_globally', $form_state
    ->getValue('recaptcha_use_globally'))
    ->set('widget.theme', $form_state
    ->getValue('recaptcha_theme'))
    ->set('widget.type', $form_state
    ->getValue('recaptcha_type'))
    ->set('widget.size', $form_state
    ->getValue('recaptcha_size'))
    ->set('widget.tabindex', $form_state
    ->getValue('recaptcha_tabindex'))
    ->set('widget.noscript', $form_state
    ->getValue('recaptcha_noscript'))
    ->save();
  parent::submitForm($form, $form_state);
}