protected function BookManager::setParents in Drupal 8
Same name and namespace in other branches
- 9 core/modules/book/src/BookManager.php \Drupal\book\BookManager::setParents()
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.
1 call to BookManager::setParents()
- BookManager::saveBookLink in core/
modules/ book/ src/ BookManager.php - Saves a single book entry.
File
- core/
modules/ book/ src/ BookManager.php, line 942
Class
- BookManager
- Defines a book manager.
Namespace
Drupal\bookCode
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;
}
}