You are here

function _nodehierarchy_build_tree in Node Hierarchy 7.4

Get a tree of nodes of the given type.

1 call to _nodehierarchy_build_tree()
_nodehierarchy_parent_options in ./nodehierarchy.admin.inc
Return a list of menu items that are valid possible parents for the given node.

File

./nodehierarchy.admin.inc, line 564
Admin functions for Node Hierarchy

Code

function _nodehierarchy_build_tree($nodes) {
  foreach ($nodes as $node) {
    $node->is_child = FALSE;
    $node->disabled = FALSE;
    if (!empty($node->pnid)) {
      if (isset($nodes[$node->pnid])) {
        $node->is_child = TRUE;
        $nodes[$node->pnid]->children[$node->nid] =& $nodes[$node->nid];
      }
    }
  }
  foreach ($nodes as $nid => $node) {
    if ($node->is_child) {
      unset($nodes[$nid]);
    }
  }
  return $nodes;
}