Index: relativity.module =================================================================== --- relativity.module (revision 1064) +++ relativity.module (working copy) @@ -1280,6 +1280,29 @@ $tokens = array(); // check if the node has parents if (isset($node->parent_node)) { + + // Avoid messing up the node variable. + $parent = $node; + + $titlepath = ''; + do { + $parents = $parent->parent_node; + + // Make the one parent and multiple parents situations more similar. + if (!is_array($parents)) { + $parents = array($parents); + } + + $parent = node_load(array_shift($parents)); + + // Compose the path by adding a "/" between every title. + $titlepath = $parent->title . "/" . $titlepath; + + // And loop as long as there are higher level parents. + } while (isset($parent->parent_node)); + + $values['parent-titlepath'] = $titlepath; + // get the first parent if the node has many parents if (is_array($node->parent_node)) { $parent = node_load(array_shift($node->parent_node)); @@ -1338,6 +1361,8 @@ $values['parent-menu'] = ''; $values['parent-menupath'] = ''; } + + } else { $values['parent-nid'] = ''; @@ -1372,6 +1397,7 @@ $values['parent-mod-d'] = ''; $values['parent-menu'] = ''; $values['parent-menupath'] = ''; + $values['parent-titlepath'] = ''; } return $values; } @@ -1407,6 +1433,7 @@ $tokens['relativity']['parent-mod-????'] = t('All tokens for node creation dates can also be used with with the "mod-" prefix; doing so will use the modification date rather than the creation date.'); $tokens['relativity']['parent-menu'] = t("The name of the menu the node belongs to."); $tokens['relativity']['parent-menupath'] = t("The menu path (as reflected in the breadcrumb), not including Home or [menu]. Separated by /."); + $tokens['relativity']['parent-titlepath'] = t("The path formed by all the parents titles"); return $tokens; } }