function pathauto_taxonomy in Pathauto 6
Same name and namespace in other branches
- 5.2 pathauto.module \pathauto_taxonomy()
- 5 pathauto_taxonomy.inc \pathauto_taxonomy()
- 6.2 pathauto.module \pathauto_taxonomy()
Implements hook_taxonomy().
1 string reference to 'pathauto_taxonomy'
- _pathauto_include in ./
pathauto.module - Include all Pathauto include files.
File
- ./
pathauto.module, line 472 - 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;
// Skip processing if the user has disabled pathauto for the term.
if (isset($term->pathauto_perform_alias) && empty($term->pathauto_perform_alias)) {
return;
}
// Clear the taxonomy term's static cache.
if ($op == 'update') {
taxonomy_get_term($term->tid, TRUE);
}
// Use the category info to automatically create an alias
_pathauto_include();
if ($term->name) {
$count = _taxonomy_pathauto_alias($term, $op);
}
// For all children generate new alias (important if [catpath] used)
foreach (taxonomy_get_tree($term->vid, $term->tid) as $subcategory) {
$count = _taxonomy_pathauto_alias($subcategory, $op);
}
break;
case 'delete':
// If the category is deleted, remove the path aliases
$term = (object) $object;
path_set_alias('taxonomy/term/' . $term->tid);
path_set_alias(taxonomy_term_path($term));
path_set_alias('forum/' . $term->tid);
path_set_alias('taxonomy/term/' . $term->tid . '/0/feed');
break;
}
break;
case 'vocabulary':
$vocabulary = (object) $object;
switch ($op) {
case 'delete':
pathauto_field_attach_delete_bundle('taxonomy', $vocabulary->vid);
break;
}
break;
}
}