function BookManager::setParents
Same name in other branches
- 9 core/modules/book/src/BookManager.php \Drupal\book\BookManager::setParents()
- 8.9.x core/modules/book/src/BookManager.php \Drupal\book\BookManager::setParents()
- 11.x 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
File
-
core/
modules/ book/ src/ BookManager.php, line 982
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;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.