You are here

public function AdvbanSettingsForm::submitForm in Advanced ban 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/AdvbanSettingsForm.php, line 147

Class

AdvbanSettingsForm
Configure advban settings for this site.

Namespace

Drupal\advban\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('advban.settings')
    ->set('expiry_durations', $form_state
    ->getValue('advban_expiry_durations'))
    ->set('default_expiry_duration', $this->ipManager
    ->expiryDurations($form_state
    ->getValue('advban_default_expiry_duration')))
    ->set('save_last_expiry_duration', $form_state
    ->getValue('advban_save_last_expiry_duration'))
    ->set('range_ip_format', $form_state
    ->getValue('advban_range_ip_format'))
    ->set('advban_ban_text', $form_state
    ->getValue('advban_ban_text'))
    ->set('advban_ban_expire_text', $form_state
    ->getValue('advban_ban_expire_text'))
    ->save();
  parent::submitForm($form, $form_state);
}