1 book.module _book_flatten_menu($tree, &$flat)

Recursively converts a tree of menu links to a flat array.

Parameters

$tree: A tree of menu links in an array.

$flat: A flat array of the menu links from $tree, passed by reference.

See also

book_get_flat_menu().

File

core/modules/book/book.module, line 708
Allows users to create and organize related content in an outline.

Code

function _book_flatten_menu($tree, &$flat) {
  foreach ($tree as $data) {
    if (!$data['link']['hidden']) {
      $flat[$data['link']['mlid']] = $data['link'];
      if ($data['below']) {
        _book_flatten_menu($data['below'], $flat);
      }
    }
  }
}