You are here

public function RequireLoginSettingsForm::submitForm in Require Login 8.2

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/RequireLoginSettingsForm.php, line 227

Class

RequireLoginSettingsForm
Configure Require Login settings for this site.

Namespace

Drupal\require_login\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('require_login.config')
    ->set('auth_path', $form_state
    ->getValue('auth_path'))
    ->set('destination_path', $form_state
    ->getValue('destination_path'))
    ->set('deny_message', $form_state
    ->getValue('deny_message'))
    ->set('excluded_403', $form_state
    ->getValue('excluded_403'))
    ->set('excluded_404', $form_state
    ->getValue('excluded_404'))
    ->set('excluded_paths', $form_state
    ->getValue('excluded_paths'))
    ->set('excluded_node_types', $form_state
    ->getValue('excluded_node_types'))
    ->set('excluded_routes', $form_state
    ->getValue('excluded_routes'))
    ->save();

  // Flush caches so changes take immediate effect.
  drupal_flush_all_caches();
  parent::submitForm($form, $form_state);
}