function BanDelete::submitForm

Same name and namespace in other branches
  1. 9 core/modules/ban/src/Form/BanDelete.php \Drupal\ban\Form\BanDelete::submitForm()
  2. 8.9.x core/modules/ban/src/Form/BanDelete.php \Drupal\ban\Form\BanDelete::submitForm()
  3. 11.x core/modules/ban/src/Form/BanDelete.php \Drupal\ban\Form\BanDelete::submitForm()

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 FormInterface::submitForm

File

core/modules/ban/src/Form/BanDelete.php, line 100

Class

BanDelete
Provides a form to unban IP addresses.

Namespace

Drupal\ban\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->ipManager
    ->unbanIp($this->banIp);
  $this->logger('user')
    ->notice('Deleted %ip', [
    '%ip' => $this->banIp,
  ]);
  $this->messenger()
    ->addStatus($this->t('The IP address %ip was deleted.', [
    '%ip' => $this->banIp,
  ]));
  $form_state->setRedirectUrl($this->getCancelUrl());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.