protected BookManager::setParents(array &$link, array $parent)
Sets the p1 through p9 properties for a book link being saved.
Parameters
array $link: The book link to update, passed by reference.
array $parent: The parent values to set.
File
- core/modules/book/src/BookManager.php, line 911
Class
- BookManager
- Defines a book manager.
Namespace
Drupal\book
Code
protected function setParents(array &$link, array $parent) {
$i = 1;
while ($i < $link['depth']) {
$p = 'p' . $i++;
$link[$p] = $parent[$p];
}
$p = 'p' . $i++;
// The parent (p1 - p9) corresponding to the depth always equals the nid.
$link[$p] = $link['nid'];
while ($i <= static::BOOK_MAX_DEPTH) {
$p = 'p' . $i++;
$link[$p] = 0;
}
}
Please login to continue.