You are here

public function DeleteForm::submitForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/forum/src/Form/DeleteForm.php \Drupal\forum\Form\DeleteForm::submitForm()
  2. 10 core/modules/forum/src/Form/DeleteForm.php \Drupal\forum\Form\DeleteForm::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/forum/src/Form/DeleteForm.php, line 64

Class

DeleteForm
Builds the form to delete a forum term.

Namespace

Drupal\forum\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->taxonomyTerm
    ->delete();
  $this
    ->messenger()
    ->addStatus($this
    ->t('The forum %label and all sub-forums have been deleted.', [
    '%label' => $this->taxonomyTerm
      ->label(),
  ]));
  $this
    ->logger('forum')
    ->notice('forum: deleted %label and all its sub-forums.', [
    '%label' => $this->taxonomyTerm
      ->label(),
  ]);
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}