You are here

public function DeleteWordForm::submitForm in Restrict Abusive Words 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 FormInterface::submitForm

File

src/Form/DeleteWordForm.php, line 61
Contains \Drupal\restrict_abusive_words\Form\DeleteWordForm.

Class

DeleteWordForm
Contribute form.

Namespace

Drupal\restrict_abusive_words\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $connection = Database::getConnection();
  if (!empty($this->wid)) {
    $connection
      ->delete('restrict_abusive_words')
      ->condition('id', $this->wid)
      ->execute();
  }
  $form_state
    ->setRedirect('restrict_abusive_words.list_words');
}