function BookManager::updateParent
Same name in other branches
- 9 core/modules/book/src/BookManager.php \Drupal\book\BookManager::updateParent()
- 10 core/modules/book/src/BookManager.php \Drupal\book\BookManager::updateParent()
- 11.x 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 897
Class
- BookManager
- Defines a book manager.
Namespace
Drupal\bookCode
protected function updateParent(array $link) {
if ($link['pid'] == 0) {
// Nothing to update.
return TRUE;
}
return $this->bookOutlineStorage
->update($link['pid'], [
'has_children' => 1,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.