function BookRemoveForm::submitForm

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

Overrides FormInterface::submitForm

File

core/modules/book/src/Form/BookRemoveForm.php, line 103

Class

BookRemoveForm
Remove form for book module.

Namespace

Drupal\book\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    if ($this->bookManager
        ->checkNodeIsRemovable($this->node)) {
        $this->bookManager
            ->deleteFromBook($this->node
            ->id());
        $this->messenger()
            ->addStatus($this->t('The post has been removed from the book.'));
    }
    $form_state->setRedirectUrl($this->getCancelUrl());
}

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