You are here

function rules_action_path_alias in Rules 6

Same name and namespace in other branches
  1. 7.2 modules/path.eval.inc \rules_action_path_alias()

Action Implementation

Related topics

File

rules/modules/path.rules.inc, line 68
Rules integration for the path module

Code

function rules_action_path_alias($settings) {
  $dst = rules_clean_path($settings['dst'], $settings['replace']);

  // Only set the alias if the path alias isn't taken yet.
  if (!drupal_lookup_path('source', $dst)) {
    path_set_alias($settings['src'], $dst, NULL, $settings['language']);
  }
  elseif (!$settings['src']) {
    path_set_alias(NULL, $dst, NULL, $settings['language']);
  }
}