You are here

function _book_flatten_menu in Drupal 7

Same name and namespace in other branches
  1. 6 modules/book/book.module \_book_flatten_menu()

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().

1 call to _book_flatten_menu()
book_get_flat_menu in modules/book/book.module
Gets the book menu tree for a page and returns it as a linear array.

File

modules/book/book.module, line 744
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);
      }
    }
  }
}