public function BookOutline::childrenLinks in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/book/src/BookOutline.php \Drupal\book\BookOutline::childrenLinks()
Formats the book links for the child pages of the current page.
Parameters
array $book_link: A fully loaded book link that is part of the book hierarchy.
Return value
array HTML for the links to the child pages of the current page.
File
- core/
modules/ book/ src/ BookOutline.php, line 110 - Contains \Drupal\book\BookOutline.
Class
- BookOutline
- Provides handling to render the book outline.
Namespace
Drupal\bookCode
public function childrenLinks(array $book_link) {
$flat = $this->bookManager
->bookTreeGetFlat($book_link);
$children = array();
if ($book_link['has_children']) {
// Walk through the array until we find the current page.
do {
$link = array_shift($flat);
} while ($link && $link['nid'] != $book_link['nid']);
// Continue though the array and collect the links whose parent is this page.
while (($link = array_shift($flat)) && $link['pid'] == $book_link['nid']) {
$data['link'] = $link;
$data['below'] = '';
$children[] = $data;
}
}
if ($children) {
return $this->bookManager
->bookTreeOutput($children);
}
return '';
}