function view_alias_create_alias in View Alias 6.2
Same name and namespace in other branches
- 7 view_alias.module \view_alias_create_alias()
Given a term, generate its view aliases.
3 calls to view_alias_create_alias()
- view_alias_delete_alias in ./
view_alias.module - Delete an alias set by View Alias.
- view_alias_pathauto_bulkupdate in ./
view_alias.module - Do the bulk updating for view aliases
- view_alias_taxonomy in ./
view_alias.module - Implementation of hook_taxonomy().
File
- ./
view_alias.module, line 145 - Hook implementations for view alias module integration.
Code
function view_alias_create_alias($term, $alias, $op) {
module_load_include('inc', 'pathauto');
// switch around the pattern based on if the term id is contained within the new alias
if (strpos($alias->path, '%') === FALSE) {
$source = "{$alias->path}/{$term->tid}";
$GLOBALS['conf']['pathauto_view_alias_pattern'] = $alias->path . "/[cat-raw]";
}
else {
$source = str_replace('%', $term->tid, $alias->path);
$GLOBALS['conf']['pathauto_view_alias_pattern'] = str_replace('%', '[cat-raw]', $alias->path);
}
$placeholders = array(
'tokens' => array(
'[cat-raw]',
),
'values' => array(
pathauto_cleanstring($term->name),
),
);
$alias_path = pathauto_create_alias('view_alias', $op, $placeholders, $source, $alias->path);
unset($GLOBALS['conf']['pathauto_view_alias_pattern']);
return $alias_path;
}