function pathauto_taxonomy in Pathauto 6.2
Same name and namespace in other branches
- 5.2 pathauto.module \pathauto_taxonomy()
- 5 pathauto_taxonomy.inc \pathauto_taxonomy()
- 6 pathauto.module \pathauto_taxonomy()
Implements hook_taxonomy().
File
- ./
pathauto.module, line 523 - 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':
$term = (object) $object;
// Clear the taxonomy term's static cache.
if ($op == 'update') {
taxonomy_get_term($term->tid, TRUE);
}
pathauto_taxonomy_term_update_alias($term, $op);
break;
case 'delete':
// If the category is deleted, remove the path aliases
$term = (object) $object;
$term_path = taxonomy_term_path($term);
pathauto_path_delete_all($term_path);
if ($term_path != "taxonomy/term/{$term->tid}") {
pathauto_path_delete_all("taxonomy/term/{$term->tid}");
}
break;
}
break;
case 'vocabulary':
$vocabulary = (object) $object;
switch ($op) {
case 'delete':
pathauto_field_attach_delete_bundle('taxonomy', $vocabulary->vid);
break;
}
break;
}
}