? token.615.patch
? token_cleanup.patch
Index: nodehierarchy_token.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodehierarchy/includes/nodehierarchy_token.inc,v
retrieving revision 1.2.2.1
diff -u -p -r1.2.2.1 nodehierarchy_token.inc
--- nodehierarchy_token.inc	27 Aug 2010 22:23:31 -0000	1.2.2.1
+++ nodehierarchy_token.inc	14 Nov 2010 20:20:49 -0000
@@ -31,6 +31,20 @@ function nodehierarchy_token_values($typ
     $tokens['fullhierarchytitlepath-raw']  = nodehierarchy_token_get_fullhierarchytitlepath($node, TRUE);
     $tokens['hierarchypath']               = nodehierarchy_token_get_hierarchypath($node->nid);
     $tokens['fullhierarchypath']           = nodehierarchy_token_get_fullhierarchypath($node);
+
+    // As of Pathauto 1.5+ or 2.0-alpha3+ in combination with Token 6.15, 
+    // Path and URL tokens are left alone by Pathauto except for tokens with 'path' 
+    // in the name and who's corresponding value is an array of segments.
+    // This usage can be checked for by the existence $options['pathauto']
+    // See also 'Using path style tokens' at http://drupal.org/node/936068  
+    if ( !empty($options['pathauto']) ) {
+      $tokens['hierarchytitlepath']          = explode("/", $tokens['hierarchytitlepath']);
+      $tokens['fullhierarchytitlepath']      = explode("/", $tokens['fullhierarchytitlepath']);
+      $tokens['hierarchytitlepath-raw']      = explode("/", $tokens['hierarchytitlepath-raw']);
+      $tokens['fullhierarchytitlepath-raw']  = explode("/", $tokens['fullhierarchytitlepath-raw']);
+      $tokens['hierarchypath']               = explode("/", $tokens['hierarchypath']);
+      $tokens['fullhierarchypath']           = explode("/", $tokens['fullhierarchypath']);
+    }
   }
 
   return $tokens;
@@ -41,16 +55,16 @@ function nodehierarchy_token_values($typ
  */
 function nodehierarchy_token_list($type = 'all') {
   if ($type == 'node' || $type == 'all') {
-    $tokens['node']['fullhierarchypath']            = t('The URL of the parent of the given node with the node title itself. Equivalent of [hierarchyurl]/[title]. This is the recommended token for hierarchical URLs.');
-    $tokens['node']['hierarchypath']                = t('The URL of the parent of the given node. Lile [fullhierarchypath] but without the node title.');
+    $tokens['node']['fullhierarchypath']            = t('The URL of the parent of the given node with the node title itself. Equivalent of [hierarchypath]/[title]. This is the recommended token for hierarchical URLs.');
+    $tokens['node']['hierarchypath']                = t('The URL of the parent of the given node. Like [fullhierarchypath] but without the node title.');
     $tokens['node']['hierarchyparenttitle']         = t("The node's parent's title.");
     $tokens['node']['hierarchyparenttitle-raw']     = t("The node's parent's title. WARNING - raw user input.");
     $tokens['node']['hierarchyparentnid']           = t("The node's parent's nid.");
 
     $tokens['node']['hierarchytitlepath']          = t("The node's ancestors' titles in order. Separated by /.");
     $tokens['node']['hierarchytitlepath-raw']      = t("The node's ancestors' titles in order. Separated by /. WARNING - raw user input.");
-    $tokens['node']['fullhierarchytitlepath']      = t("The node's ancestors' titles in order of the title of the node itself. Separated by /. Equivalent of [hierarchypath]/[title].");
-    $tokens['node']['fullhierarchytitlepath-raw']  = t("The node's ancestors' titles in order of the title of the node itself. Separated by /. Equivalent of [hierarchypath]/[title]. WARNING - raw user input.");
+    $tokens['node']['fullhierarchytitlepath']      = t("The node's ancestors' titles in order, plus the title of the node itself. Separated by /. Equivalent of [hierarchytitlepath]/[title].");
+    $tokens['node']['fullhierarchytitlepath-raw']  = t("The node's ancestors' titles in order, plus the title of the node itself. Separated by /. Equivalent of [hierarchytitlepath]/[title]. WARNING - raw user input.");
 
     return $tokens;
   }
@@ -94,7 +108,8 @@ function nodehierarchy_token_get_hierarc
     }
     else {
       // recurse
-      return nodehierarchy_token_get_fullhierarchypath($pnid);
+      $parent_node = node_load($pnid);
+      return nodehierarchy_token_get_fullhierarchypath($parent_node);
     }
   }
   return "";
