/**
* {@inheritdoc}
*/
public function saveBookLink(array
$link,
$new) { // Keep track of Book IDs for cache clear.
$affected_bids[$link['bid'
]] =
$link['bid'
];
$link +=
$this->
getLinkDefaults($link['nid'
]);
if ($new) { // Insert new.
$parents =
$this->
getBookParents($link,
(array) $this->
loadBookLink($link['pid'
], FALSE
));
$this->bookOutlineStorage->
insert($link,
$parents);
// Update the has_children status of the parent.
$this->
updateParent($link);
} else { $original =
$this->
loadBookLink($link['nid'
], FALSE
);
// Using the Book ID as the key keeps this unique.
$affected_bids[$original['bid'
]] =
$original['bid'
];
// Handle links that are moving.
if ($link['bid'
] !=
$original['bid'
] ||
$link['pid'
] !=
$original['pid'
]) {