--- pathauto_taxonomy.inc Thu Oct 19 16:38:28 2006 +++ pathauto_taxonomy.inc Thu Feb 15 12:19:41 2007 @@ -62,31 +62,40 @@ $vocabulary = taxonomy_get_vocabulary($vid); $placeholders[t('[vocab]')] = pathauto_cleanstring($vocabulary->name); - $placeholders[t('[cat]')] = pathauto_cleanstring($category->name); - $placeholders[t('[tid]')] = $category->tid; - - if ($category->parent) { - $catpath = pathauto_cleanstring($category->name); - $parents = taxonomy_get_parents_all($category->parent); + $allcategories = array(); + $allcategories[] = $category; + // only add sub categories if [catpath] is selected! + + // keep category at the end in that way placeholders will be for category that is passed to module_invoke_all() !!! + $allcategories = array_merge(taxonomy_get_tree($category->vid,$category->tid),$allcategories); + foreach ($allcategories as $cat){ + $placeholders[t('[cat]')] = pathauto_cleanstring($cat->name); + $placeholders[t('[tid]')] = $cat->tid; + if ($cat->parent) { + $catpath = pathauto_cleanstring($cat->name); + $parents = taxonomy_get_parents_all($cat->parent); } else { $catpath = ''; - $parents = taxonomy_get_parents_all($category->tid); + $parents = taxonomy_get_parents_all($cat->tid); } - foreach ($parents as $parent) { $catpath = pathauto_cleanstring($parent->name).'/'.$catpath; } $placeholders[t('[catpath]')] = $catpath; // Append any additional extensions - $extplaceholders = module_invoke_all('pathauto_taxonomy', 'values', $category); + $extplaceholders = module_invoke_all('pathauto_taxonomy', 'values', $cat); $placeholders = array_merge($placeholders, $extplaceholders); - $src = taxonomy_term_path($category); + $src = taxonomy_term_path($cat); $alias = pathauto_create_alias('taxonomy', $op, $placeholders, $src, $vid); } + + // Append any additional extensions + module_invoke_all('pathauto_taxonomy', $op, $category, $placeholders); + } break; case 'delete': /* @@ -96,6 +105,9 @@ $category = (object) $object; path_set_alias('taxonomy/term/'.$category->tid); path_set_alias('forum/'.$category->tid); + + // Append any additional extensions + module_invoke_all('pathauto_taxonomy', 'delete', $category); break; default: break;