function _book_flatten_menu

_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

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);
      }
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!book!book.module/function/_book_flatten_menu/7.x