function DeleteForm::submitForm

Same name in other branches
  1. 9 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()
  3. 11.x core/modules/forum/src/Form/DeleteForm.php \Drupal\forum\Form\DeleteForm::submitForm()

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());
}

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