You are here

function nodehierarchy_get_node_ancestor_nids in Node Hierarchy 7.4

Same name and namespace in other branches
  1. 6.3 nodehierarchy.module \nodehierarchy_get_node_ancestor_nids()
  2. 6.2 nodehierarchy.module \nodehierarchy_get_node_ancestor_nids()
  3. 7.2 nodehierarchy.module \nodehierarchy_get_node_ancestor_nids()

Get the ALL ancestor nodes for the given node.

@TODO: make this more efficient by implementing a materialized path or similar.

3 calls to nodehierarchy_get_node_ancestor_nids()
nodehierarchy_parent_selector_validate in ./nodehierarchy.admin.inc
Validate the parent node selector to make sure the parent is legal.
views_plugin_argument_default_ancestor::get_argument in includes/views/views_plugin_argument_default_ancestor.inc
Return the default argument.
_nodehierarchy_widgets_is_invalid_parent in nodehierarchy_widgets/nodehierarchy_widgets.module
Return a list of menu items that are valid possible parents for the given node.

File

./nodehierarchy.api.inc, line 82
API functions for Node Hierarchy

Code

function nodehierarchy_get_node_ancestor_nids($node) {
  $out = array();
  foreach (nodehierarchy_get_node_parent_nids($node) as $parent) {
    $out = nodehierarchy_get_node_ancestor_nids($parent);
    $out[] = $parent;
  }
  return $out;
}