function pathauto_taxonomy_term_update_alias in Pathauto 6.2
Same name and namespace in other branches
- 7 pathauto.module \pathauto_taxonomy_term_update_alias()
Update the URL aliases for an individual taxonomy term.
Parameters
$term: A taxonomy term object.
$op: Operation being performed on the term ('insert', 'update' or 'bulkupdate').
$options: An optional array of additional options.
3 calls to pathauto_taxonomy_term_update_alias()
- pathauto_taxonomy in ./
pathauto.module - Implements hook_taxonomy().
- pathauto_taxonomy_term_update_action in ./
pathauto.module - Update action wrapper for pathauto_taxonomy_term_update_alias().
- pathauto_taxonomy_term_update_alias_multiple in ./
pathauto.module - Update the URL aliases for multiple taxonomy terms.
File
- ./
pathauto.module, line 572 - Main file for the Pathauto module, which automatically generates aliases for content.
Code
function pathauto_taxonomy_term_update_alias($term, $op, $options = array()) {
// Skip processing if the user has disabled pathauto for the term.
if (isset($term->pathauto_perform_alias) && empty($term->pathauto_perform_alias) && empty($options['force'])) {
return;
}
$options += array(
'alias children' => FALSE,
'language' => isset($term->language) ? $term->language : '',
);
$module = 'taxonomy';
if (module_exists('forum') && $term->vid == variable_get('forum_nav_vocabulary', '')) {
$module = 'forum';
}
// Skip processing if the term has no pattern.
if (!pathauto_pattern_load_by_entity($module, $term->vid, $options['language'])) {
return;
}
module_load_include('inc', 'pathauto');
$source = taxonomy_term_path($term);
pathauto_create_alias($module, $op, $source, array(
'taxonomy' => $term,
), $term->tid, $term->vid, $options['language']);
if (!empty($options['alias children'])) {
// For all children generate new aliases.
$options['alias children'] = FALSE;
unset($options['language']);
foreach (taxonomy_get_tree($term->vid, $term->tid) as $subterm) {
pathauto_taxonomy_term_update_alias($subterm, $op, $options);
}
}
}