Posted by imclean on April 1, 2009 at 5:56am
| Project: | Content Taxonomy |
| Version: | 6.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Issue Summary
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 |
Comments
#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.
#7
Here is an updated patch.
This is extremely useful for filefield_paths module.
#8
subscribing - would you kindly give an example of how this token will look?
#9
So I've confirmed the approach works. I've just added in a check to make sure there is at least one tid. RTBC
yaz085 a screenshot of what exactly?
#10
#11
slightly updated.
#12
Thanks! I used patch in comment #9 and this works really great.
#13
subscribing
#14
Be sure to wait until after #881270: [bookpath], [menupath], [*path] tokens not cleaned: aliases without punctuation removed, lower casing, etc. is resolved before committing this.
#15
subscribing
#16
Thoughts on getting this to work with the latest Token and Pathauto devs?
::
#17
Also requires commit of #932680: content_token_values() does not pass along $options to the called hook_token_values().
::
#18
New patch.
#19
I could't get #17 to work and hadn't the time to investigate further. The patch in #18 works great. Thanks a lot!
#20
subscribing
#21
This seems a very good feature. Any idea why it's not in dev?
#22
Just to expand on what I want to do.
I need to organise my sites catalog and products with term-paths. The standard Taxonomy/Pathauto solution has big troubles with multiple terms on 1 node.
I thought to be clever and use Content Taxonomy with 2 fields, 1 main field with 1 required term for a pathauto term/path and one for extra terms (multiple). Both should sync with the core Taxonomy module for breadcrumbs, Views and things.
Any idea if this would work with this patch?
#23
Tested the patch against latest dev. Seems to be working flawless except for some whitespace BS from Git. Nothing really to worry about.
RTBC
#24
Works well for me. It would be great to see this rolled in, it's a very useful feature.