Issue Summary
I think a new token should be added to include the full path for a term.
My nodes may have several taxonomy categories assigned to them but I would like the auto-generated URL alias to use the primary term's full path. e.g. I may have node ID 1 which is assigned to the following categories (taxonomy) -
dvd/action
dvd/fantasy
fantasy-films/dvd
I may want the dvd/fantasy to be the primary term and have the URL only to be mysite.com/dvd/fantasy/1 even if someone arrives to the node by clicking on a link within mysite.com/fantasy-films/dvd. Currently this is not possible because if I use the [primary-term] token for my url, the url alias would be generated as mysite.com/dvd. With pathauto I can use the [termpath] or [termpath-raw] token which separates the category and supercategories with '/' but when a node has multiple categories assigned to it, the [termpath] token will use the first (or lowest weight) category to generate the URL and in my example that would be dvd/action.
Comments
#1
Here's a patch for it.
I needed it for a project.
#2
+1 for this patch
#3
works wonderfully
#4
more tokens: #670724: Vocab Token
#5
+1
Looks good to me.
#6
+1
#7
This patch is great and I've been using it for ages but was wondering when it will be officially released?
I've also written another token that works with Ubercart and was wondering if something like this could be included too?
in function primary_term_token_list()
if (module_exists('uc_catalog') {$tokens['node']['primary-termpath-uc-raw'] = t('Full catalog path to Primary Term');
}
and in function primary_term_token_values()
if (module_exists('uc_catalog') {$values['primary-termpath-uc-raw'] = drupal_get_path_alias(uc_catalog_path($term));
}
I've not fully tested this as my custom module I put these in depends on uc_catalog so I don't know if the module_exists part works for sure or not.
#8
I am marking this module a duplicate of #670724: Vocab Token since that issue has the token added by the patch in #1 as well as a second relevant token. I'll log a cumulative commit of tokens against that issue.