? content_taxonomy-termpath-tokens.420240-2.patch Index: includes/content_taxonomy.token.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/content_taxonomy/includes/Attic/content_taxonomy.token.inc,v retrieving revision 1.1.2.2 diff -u -p -r1.1.2.2 content_taxonomy.token.inc --- includes/content_taxonomy.token.inc 14 May 2009 14:30:26 -0000 1.1.2.2 +++ includes/content_taxonomy.token.inc 11 Mar 2010 00:07:44 -0000 @@ -12,6 +12,8 @@ function content_taxonomy_token_list($ty $tokens['content_taxonomy']['tid'] = t('ID of top taxonomy term'); $tokens['content_taxonomy']['terms'] = t('Names of all taxonomy terms separated by commas'); $tokens['content_taxonomy']['terms-raw'] = t('Unfiltered names of all taxonomy terms separated by commas. WARNING - raw user input.'); + $tokens['content_taxonomy']['termpath'] = t('Name of top taxonomy term and its supercategories separated by /'); + $tokens['content_taxonomy']['termpath-raw'] = t('Name of top taxonomy term and its supercategories separated by /. WARNING - raw user input.'); $tokens['content_taxonomy']['tids'] = t('IDs of all taxonomy terms separated by commas'); $tokens['content_taxonomy']['vocab'] = t('Name of terms vocabulary'); $tokens['content_taxonomy']['vid'] = t('ID of terms vocabulary'); @@ -42,8 +44,18 @@ function content_taxonomy_token_values($ $vocabulary = taxonomy_vocabulary_load($vid); } + // Gather term hierarchy, but only for the first term. + if (count($tids)) { + $parents = taxonomy_get_parents_all($tids[0]); + foreach ($parents as $parent) { + $parent_names[] = check_plain($parent->name); + } + } + $tokens['terms-raw'] = implode(', ', $terms); $tokens['terms'] = check_plain($tokens['terms-raw']); + $tokens['termpath-raw'] = count($parent_names) ? implode('/', array_reverse($parent_names)) : ''; + $tokens['termpath'] = check_plain($tokens['termpath-raw']); $tokens['tids'] = implode(', ', $tids); $tokens['term-raw'] = $terms[0]; $tokens['term'] = check_plain($tokens['term-raw']);