You are here

protected function BookManager::updateParent in Drupal 9

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

Sets the has_children flag of the parent of the node.

This method is mostly called when a book link is moved/created etc. So we want to update the has_children flag of the new parent book link.

Parameters

array $link: The book link, data reflecting its new position, whose new parent we want to update.

Return value

bool TRUE if the update was successful (either there is no parent to update, or the parent was updated successfully), FALSE on failure.

1 call to BookManager::updateParent()
BookManager::saveBookLink in core/modules/book/src/BookManager.php
Saves a single book entry.

File

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

Class

BookManager
Defines a book manager.

Namespace

Drupal\book

Code

protected function updateParent(array $link) {
  if ($link['pid'] == 0) {

    // Nothing to update.
    return TRUE;
  }
  return $this->bookOutlineStorage
    ->update($link['pid'], [
    'has_children' => 1,
  ]);
}