You are here

public function HCaptchaAdminSettingsForm::submitForm in hCaptcha 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/HCaptchaAdminSettingsForm.php, line 108

Class

HCaptchaAdminSettingsForm
Configure hCaptcha settings for this site.

Namespace

Drupal\hcaptcha\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('hcaptcha.settings');
  $config
    ->set('site_key', $form_state
    ->getValue('hcaptcha_site_key'))
    ->set('secret_key', $form_state
    ->getValue('hcaptcha_secret_key'))
    ->set('widget.theme', $form_state
    ->getValue('hcaptcha_theme'))
    ->set('widget.size', $form_state
    ->getValue('hcaptcha_size'))
    ->set('widget.tabindex', $form_state
    ->getValue('hcaptcha_tabindex'))
    ->save();
  parent::submitForm($form, $form_state);
}