You are here

public function BookManager::deleteFromBook in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/book/src/BookManager.php \Drupal\book\BookManager::deleteFromBook()

Deletes node's entry from book table.

Parameters

int $nid: The nid to delete.

Overrides BookManagerInterface::deleteFromBook

File

core/modules/book/src/BookManager.php, line 435
Contains \Drupal\book\BookManager.

Class

BookManager
Defines a book manager.

Namespace

Drupal\book

Code

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);
    foreach ($result as $child) {
      $child['bid'] = $child['nid'];
      $this
        ->updateOutline($child);
    }
  }
  $this
    ->updateOriginalParent($original);
  $this->books = NULL;
  Cache::invalidateTags(array(
    'bid:' . $original['bid'],
  ));
}