You are here

public function SecureLoginConfigForm::submitForm in Secure Login 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/SecureLoginConfigForm.php, line 147

Class

SecureLoginConfigForm
Implements a SecureLogin Config form.

Namespace

Drupal\securelogin\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('securelogin.settings')
    ->set('base_url', $form_state
    ->getValue('base_url'))
    ->set('secure_forms', $form_state
    ->getValue('secure_forms'))
    ->set('all_forms', $form_state
    ->getValue('all_forms'))
    ->set('other_forms', $form_state
    ->getValue('other_forms'))
    ->set('form_user_login_form', $form_state
    ->getValue('form_user_login_form'))
    ->set('form_user_pass_reset', $form_state
    ->getValue('form_user_pass_reset'))
    ->set('form_user_form', $form_state
    ->getValue('form_user_form'))
    ->set('form_user_register_form', $form_state
    ->getValue('form_user_register_form'))
    ->set('form_user_pass', $form_state
    ->getValue('form_user_pass'))
    ->save();
  $forms = [];
  $this->moduleHandler
    ->alter('securelogin', $forms);
  foreach ($forms as $id => $item) {
    $this
      ->config('securelogin.settings')
      ->set("form_{$id}", $form_state
      ->getValue("form_{$id}"))
      ->save();
  }
  drupal_register_shutdown_function('drupal_flush_all_caches');
  parent::submitForm($form, $form_state);
}