_book_toc_recurse

6 book.module _book_toc_recurse($tree, $indent, &$toc, $exclude, $depth_limit)
7 book.module _book_toc_recurse($tree, $indent, &$toc, $exclude, $depth_limit)
8 book.module _book_toc_recurse($tree, $indent, &$toc, $exclude, $depth_limit)

A recursive helper function for book_toc().

1 call to _book_toc_recurse()

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);
      }
    }
  }
}
Login or register to post comments