_menu_node_tree

Versions
menu_node
_menu_node_tree(&$tree, $menu, $data, $parents, $marker = NULL, $spacer = NULL)

A private recursive sort function.

Given a menu tree, return its child node items.

Parameters

$tree The recursive tree data.

$menu The menu that this data belongs to.

$data The tree data for this menu element.

$parents An array of menu link ids indicating the tree elements to return.

$marker A string (or NULL) to prepend to the menu link title, indicating relative depth.

$spacer A string (or NULL) to place between the marker and the title.

Return value

No return. Modify $tree by reference.

▾ 2 functions call _menu_node_tree()

menu_node_tree in ./menu_node.module
Public function for generating a tree representation of nodes in a menu.
_menu_node_tree in ./menu_node.module
A private recursive sort function.

Code

./menu_node.module, line 180

<?php
function _menu_node_tree(&$tree, $menu, $data, $parents, $marker = NULL, $spacer = NULL) {
  if (empty($tree)) {
    $tree = array();
  }
  if (empty($parents)) {
    $parents = array();
  }
  if (in_array($data['link']['mlid'], $parents)) {
    $parent = menu_node_get_parent($data['link']);
    $tree[$parent][$data['link']['mlid']] = str_repeat($marker, $data['link']['depth']) . $spacer . $data['link']['title'] . ' ';
  }
  if (!empty($data['below'])) {
    // Recursive processing joy!
    foreach ($data['below'] as $value) {
      _menu_node_tree($tree, $menu, $value, $parents, $marker, $spacer);
    }
  }
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List