menu_tree_collect_node_links

Versions
6 – 7
menu_tree_collect_node_links(&$tree, &$node_links)

Recursive helper function - collect node links.

Parameters

$tree The menu tree you wish to collect node links from.

$node_links An array in which to store the collected node links.

Related topics

▾ 5 functions call menu_tree_collect_node_links()

book_menu_subtree_data in modules/book/book.module
Get the data representing a subtree of the book hierarchy.
menu_overview_form in modules/menu/menu.admin.inc
Form for editing an entire menu tree at once.
menu_tree_all_data in includes/menu.inc
Get the data structure representing a named menu tree.
menu_tree_collect_node_links in includes/menu.inc
Recursive helper function - collect node links.
menu_tree_page_data in includes/menu.inc
Get the data structure representing a named menu tree, based on the current page.

Code

includes/menu.inc, line 975

<?php
function menu_tree_collect_node_links(&$tree, &$node_links) {
  foreach ($tree as $key => $v) {
    if ($tree[$key]['link']['router_path'] == 'node/%') {
      $nid = substr($tree[$key]['link']['link_path'], 5);
      if (is_numeric($nid)) {
        $node_links[$nid][$tree[$key]['link']['mlid']] = &$tree[$key]['link'];
        $tree[$key]['link']['access'] = FALSE;
      }
    }
    if ($tree[$key]['below']) {
      menu_tree_collect_node_links($tree[$key]['below'], $node_links);
    }
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.