Same name and namespace in other branches
  1. 7.x modules/book/book.module \_book_toc_recurse()

A recursive helper function for book_toc().

1 call to _book_toc_recurse()
book_toc in modules/book/book.module
Returns an array of book pages in table of contents order.

File

modules/book/book.module, line 834
Allows users to structure the pages of a site in a hierarchy or outline.

Code

function _book_toc_recurse($tree, $indent, &$toc, $exclude, $depth_limit) {
  foreach ($tree as $data) {
    if ($data['link']['depth'] > $depth_limit) {

      // Don't iterate through any links on this level.
      break;
    }
    if (!in_array($data['link']['mlid'], $exclude)) {
      $toc[$data['link']['mlid']] = $indent . ' ' . truncate_utf8($data['link']['title'], 30, TRUE, TRUE);
      if ($data['below']) {
        _book_toc_recurse($data['below'], $indent . '--', $toc, $exclude, $depth_limit);
      }
    }
  }
}