protected BookManager::updateOriginalParent(array $original)
Updates the has_children flag of the parent of the original node.
This method is called when a book link is moved or deleted. So we want to update the has_children flag of the parent node.
Parameters
array $original: The original link whose parent we want to update.
Return value
bool TRUE if the update was successful (either there was no original parent to update, or the original parent was updated successfully), FALSE on failure.
File
- core/modules/book/src/BookManager.php, line 888
Class
- BookManager
- Defines a book manager.
Namespace
Drupal\book
Code
protected function updateOriginalParent(array $original) { if ($original['pid'] == 0) { // There were no parents of this link. Nothing to update. return TRUE; } // Check if $original had at least one child. $original_number_of_children = $this->bookOutlineStorage->countOriginalLinkChildren($original); $parent_has_children = ((bool) $original_number_of_children) ? 1 : 0; // Update the parent. If the original link did not have children, then the // parent now does not have children. If the original had children, then the // the parent has children now (still). return $this->bookOutlineStorage->update($original['pid'], array('has_children' => $parent_has_children)); }
Please login to continue.