function rules_action_node_path_alias in Rules 7.2
Same name and namespace in other branches
- 6 rules/modules/path.rules.inc \rules_action_node_path_alias()
Action Implementation: Set the URL alias for a node.
Related topics
1 string reference to 'rules_action_node_path_alias'
- rules_path_action_info in modules/
path.rules.inc - Implements hook_rules_action_info() on behalf of the path module.
File
- modules/
path.eval.inc, line 41 - Contains rules integration for the path module needed during evaluation.
Code
function rules_action_node_path_alias($node, $alias) {
$langcode = isset($node->language) ? $node->language : LANGUAGE_NONE;
// Only set the alias if the alias is not taken yet.
if (($path = path_load(array(
'alias' => $alias,
'language' => $langcode,
))) && (empty($node->path['pid']) || $node->path['pid'] != $path['pid'])) {
rules_log('The configured alias %alias already exists. Aborting.', array(
'%alias' => $alias,
));
return FALSE;
}
$node->path['alias'] = $alias;
}