You are here

public function BookManager::checkNodeIsRemovable in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/book/src/BookManager.php \Drupal\book\BookManager::checkNodeIsRemovable()
  2. 10 core/modules/book/src/BookManager.php \Drupal\book\BookManager::checkNodeIsRemovable()

Determines if a node can be removed from the book.

A node can be removed from a book if it is actually in a book and it either is not a top-level page or is a top-level page with no children.

Parameters

\Drupal\node\NodeInterface $node: The node to remove from the outline.

Return value

bool TRUE if a node can be removed from the book, FALSE otherwise.

Overrides BookManagerInterface::checkNodeIsRemovable

File

core/modules/book/src/BookManager.php, line 258

Class

BookManager
Defines a book manager.

Namespace

Drupal\book

Code

public function checkNodeIsRemovable(NodeInterface $node) {
  return !empty($node->book['bid']) && ($node->book['bid'] != $node
    ->id() || !$node->book['has_children']);
}