On this page
function menu_tree_collect_node_links
menu_tree_collect_node_links(&$tree, &$node_links)
Collects node links from a given menu tree recursively.
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
File
- includes/menu.inc, line 1473
- API for the Drupal menu system.
Code
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);
}
}
}
© 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/includes!menu.inc/function/menu_tree_collect_node_links/7.x