You are here

public function BookRemoveForm::submitForm in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/book/src/Form/BookRemoveForm.php \Drupal\book\Form\BookRemoveForm::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/book/src/Form/BookRemoveForm.php, line 106
Contains \Drupal\book\Form\BookRemoveForm.

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());
    drupal_set_message($this
      ->t('The post has been removed from the book.'));
  }
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}