"termpath" token support for hierarchical vocabularies for use with Pathauto
imclean - April 1, 2009 - 05:56
| Project: | Content Taxonomy |
| Version: | 6.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
CT is a very handy module, thanks!
Here's a quick patch to add the "termpath" token support to the first vocabulary of the node for use with Pathauto. It really only make sense with hierarchical vocabularies.
| Attachment | Size |
|---|---|
| content-taxonomy-termpath-tokens.patch | 1.12 KB |

#1
Correction, that should be: "Here's a quick patch to add the "termpath" token support to the first term of the vocabulary".
#2
Added -raw support. Also works with FileField to some extent.
Should probably check that an array is returned:
<?phpif (is_array($parents)) {
foreach ($parents as $parent) {
$pnames[] = check_plain($parent->name);
}
if (is_array($pnames)) {
$tokens['termpath-raw'] = implode('/',array_reverse($pnames));
$tokens['termpath'] = check_plain($tokens['termpath-raw']);
}
}
?>
The above is not included in the patch. Will see what else needs fixing before I upload yet another one.
#3
Thank you :)
Works for me.
CT is really a good module.
#4
any updates on this patch -- doesnt want to apply.
#5
It's not something I'll be maintaining. If the functions the patch provides haven't been included in the dev version then they probably never will be.
The patch is only a few lines so you could have a look at it and add them yourself. The file to look for is
content_taxonomy.token.inc#6
Thanks for the reply. I did go ahead and just add the code myself. I really wish this would get included into the module — very useful.