/** * Formats the book links for the child pages of the current page. * * @param array $book_link * A fully loaded book link that is part of the book hierarchy. * * @return array * HTML for the links to the child pages of the current page. */ 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 ''; }