function pathauto_taxonomy in Pathauto 5.2
Same name and namespace in other branches
- 5 pathauto_taxonomy.inc \pathauto_taxonomy()
- 6.2 pathauto.module \pathauto_taxonomy()
- 6 pathauto.module \pathauto_taxonomy()
Implementation of hook_taxonomy().
File
- ./
pathauto.module, line 318 - Main file for the Pathauto module, which automatically generates aliases for content.
Code
function pathauto_taxonomy($op, $type, $object = NULL) {
switch ($type) {
case 'term':
switch ($op) {
case 'insert':
case 'update':
_pathauto_include();
// Use the category info to automatically create an alias
$category = (object) $object;
if ($category->name) {
$count = _taxonomy_pathauto_alias($category, $op);
}
// For all children generate new alias (important if [catpath] used)
foreach (taxonomy_get_tree($category->vid, $category->tid) as $subcategory) {
$count = _taxonomy_pathauto_alias($subcategory, $op);
}
break;
case 'delete':
// If the category is deleted, remove the path aliases
$category = (object) $object;
path_set_alias('taxonomy/term/' . $category->tid);
path_set_alias(taxonomy_term_path($category));
path_set_alias('forum/' . $category->tid);
path_set_alias('taxonomy/term/' . $category->tid . '/0/feed');
break;
default:
break;
}
break;
default:
break;
}
}