You are here

function rules_action_taxonomy_term_path_alias in Rules 7.2

Action Implementation: Set the URL alias for a node.

Related topics

File

modules/path.eval.inc, line 54
Contains rules integration for the path module needed during evaluation.

Code

function rules_action_taxonomy_term_path_alias($term, $alias) {

  // Only set the alias if the alias is not taken yet.
  if (($path = path_load(array(
    'alias' => $alias,
    'language' => LANGUAGE_NONE,
  ))) && (empty($term->path['pid']) || $term->path['pid'] != $path['pid'])) {
    rules_log('The configured alias %alias already exists. Aborting.', array(
      '%alias' => $alias,
    ));
    return FALSE;
  }
  $term->path['alias'] = $alias;
}