You are here

public function EmailConfirmerUserSettingsForm::submitForm in Email confirmer 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

email_confirmer_user/src/Form/EmailConfirmerUserSettingsForm.php, line 122

Class

EmailConfirmerUserSettingsForm
Email confirmer user settings form.

Namespace

Drupal\email_confirmer_user\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  /** @var \Drupal\Core\Config\ImmutableConfig $config */
  $config = $this
    ->config('email_confirmer_user.settings');
  $config
    ->set('user_email_change', [
    'enabled' => $form_state
      ->getValue('user_email_change_confirm') && TRUE,
    'notify_current' => $form_state
      ->getValue('user_email_change_notify_current') && TRUE,
    'consider_existent' => $form_state
      ->getValue('user_email_change_consider_existent') && TRUE,
    'limit_user_realm' => $form_state
      ->getValue('user_email_change_limit_realm') && TRUE,
  ])
    ->set('user_login', [
    'sync_core_confirmation' => $form_state
      ->getValue('sync_core_onfirstlogin_confirmation') && TRUE,
    'sync_core_onetimeloginlinks' => $form_state
      ->getValue('sync_core_onetimeloginlinks') && TRUE,
  ])
    ->save();
  parent::submitForm($form, $form_state);
}