public BookOutline::childrenLinks(array $book_link)
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 105
Class
- BookOutline
- Provides handling to render the book outline.
Namespace
Drupal\book
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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 '' ; } |
Please login to continue.