You are here

function nodehierarchy_token_get_fullhierarchypath in Node Hierarchy 6.2

Same name and namespace in other branches
  1. 5 nodehierarchy_token.inc \nodehierarchy_token_get_fullhierarchypath()
  2. 6.3 includes/nodehierarchy_token.inc \nodehierarchy_token_get_fullhierarchypath()
  3. 6 nodehierarchy_token.inc \nodehierarchy_token_get_fullhierarchypath()
2 calls to nodehierarchy_token_get_fullhierarchypath()
nodehierarchy_token_get_hierarchypath in includes/nodehierarchy_token.inc
nodehierarchy_token_values in includes/nodehierarchy_token.inc
Implementation of hook_token_values().

File

includes/nodehierarchy_token.inc, line 87
token.module integration functions for nodehierarchy.module

Code

function nodehierarchy_token_get_fullhierarchypath($node) {

  // pathauto used to strip spaces but, as of 1.4 we need to run through pathauto_cleanstring
  // per http://drupal.org/node/881270. Also works in pathauto < 1.4
  if (module_exists('pathauto')) {
    module_load_include('inc', 'pathauto', 'pathauto');
    if (function_exists('pathauto_cleanstring')) {
      return trim(nodehierarchy_token_get_hierarchypath($node->nid) . "/" . pathauto_cleanstring($node->title), "/");
    }
  }
  return trim(nodehierarchy_token_get_hierarchypath($node->nid) . "/" . $node->title, "/");
}