You are here

function nodehierarchy_token_values in Node Hierarchy 5

Same name and namespace in other branches
  1. 6.3 includes/nodehierarchy_token.inc \nodehierarchy_token_values()
  2. 6 nodehierarchy_token.inc \nodehierarchy_token_values()
  3. 6.2 includes/nodehierarchy_token.inc \nodehierarchy_token_values()

@file token.module integration functions for nodehierarchy.module

File

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

Code

function nodehierarchy_token_values($type, $object = NULL, $options = array()) {
  $tokens = array();
  if ($type == 'node') {
    $node = $object;
    $tokens['hierarchyparentnid'] = (int) $node->parent;
    $tokens['hierarchytitlepath'] = nodehierarchy_token_get_hierarchytitlepath($node);
    $tokens['fullhierarchytitlepath'] = nodehierarchy_token_get_fullhierarchytitlepath($node);
    $tokens['hierarchytitlepath-raw'] = nodehierarchy_token_get_hierarchytitlepath($node, TRUE);
    $tokens['fullhierarchytitlepath-raw'] = nodehierarchy_token_get_fullhierarchytitlepath($node, TRUE);
    $tokens['hierarchypath'] = nodehierarchy_token_get_hierarchypath($node);
    $tokens['fullhierarchypath'] = nodehierarchy_token_get_fullhierarchypath($node);
    if ($node->parent && ($parent = node_load($node->parent))) {
      $tokens['hierarchyparenttitle'] = check_plain(@$parent->title);
      $tokens['hierarchyparenttitle-raw'] = @$parent->title;
    }
    else {
      $tokens['hierarchyparenttitle'] = '';
      $tokens['hierarchyparenttitle-raw'] = '';
    }
  }
  return $tokens;
}