You are here

public function BanAdmin::submitForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/ban/src/Form/BanAdmin.php \Drupal\ban\Form\BanAdmin::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/BanAdmin.php, line 123
Contains \Drupal\ban\Form\BanAdmin.

Class

BanAdmin
Displays banned IP addresses.

Namespace

Drupal\ban\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $ip = trim($form_state
    ->getValue('ip'));
  $this->ipManager
    ->banIp($ip);
  drupal_set_message($this
    ->t('The IP address %ip has been banned.', array(
    '%ip' => $ip,
  )));
  $form_state
    ->setRedirect('ban.admin_page');
}