function nodehierarchy_token_get_hierarchypath in Node Hierarchy 6.3
Same name and namespace in other branches
- 5 nodehierarchy_token.inc \nodehierarchy_token_get_hierarchypath()
- 6 nodehierarchy_token.inc \nodehierarchy_token_get_hierarchypath()
- 6.2 includes/nodehierarchy_token.inc \nodehierarchy_token_get_hierarchypath()
2 calls to nodehierarchy_token_get_hierarchypath()
- nodehierarchy_token_get_fullhierarchypath in includes/
nodehierarchy_token.inc - nodehierarchy_token_values in includes/
nodehierarchy_token.inc - Implementation of hook_token_values().
File
- includes/
nodehierarchy_token.inc, line 99 - token.module integration functions for nodehierarchy.module
Code
function nodehierarchy_token_get_hierarchypath($nid) {
// the hierarchy path is the parent node's full hierarchy path
$parents = nodehierarchy_get_node_parent_nids($nid);
if ($pnid = @$parents[0]) {
// if the parent already has an alias (generated or entered) use that
$parent_path = drupal_get_path_alias("node/{$pnid}");
if ($parent_path != "node/{$pnid}") {
return $parent_path;
}
else {
// recurse
$parent_node = node_load($pnid);
return nodehierarchy_token_get_fullhierarchypath($parent_node);
}
}
return "";
}