function BookManager::deleteFromBook
Same name in other branches
- 8.9.x core/modules/book/src/BookManager.php \Drupal\book\BookManager::deleteFromBook()
- 10 core/modules/book/src/ProxyClass/BookManager.php \Drupal\book\ProxyClass\BookManager::deleteFromBook()
- 10 core/modules/book/src/BookManager.php \Drupal\book\BookManager::deleteFromBook()
- 11.x core/modules/book/src/ProxyClass/BookManager.php \Drupal\book\ProxyClass\BookManager::deleteFromBook()
- 11.x core/modules/book/src/BookManager.php \Drupal\book\BookManager::deleteFromBook()
Overrides BookManagerInterface::deleteFromBook
File
-
core/
modules/ book/ src/ BookManager.php, line 520
Class
- BookManager
- Defines a book manager.
Namespace
Drupal\bookCode
public function deleteFromBook($nid) {
$original = $this->loadBookLink($nid, FALSE);
$this->bookOutlineStorage
->delete($nid);
if ($nid == $original['bid']) {
// Handle deletion of a top-level post.
$result = $this->bookOutlineStorage
->loadBookChildren($nid);
$children = $this->entityTypeManager
->getStorage('node')
->loadMultiple(array_keys($result));
foreach ($children as $child) {
$child->book['bid'] = $child->id();
$this->updateOutline($child);
}
}
$this->updateOriginalParent($original);
$this->books = NULL;
Cache::invalidateTags([
'bid:' . $original['bid'],
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.