You are here

function _pathauto_set_alias in Pathauto 5

Same name and namespace in other branches
  1. 5.2 pathauto.inc \_pathauto_set_alias()
  2. 6.2 pathauto.inc \_pathauto_set_alias()
  3. 6 pathauto.inc \_pathauto_set_alias()
  4. 7 pathauto.inc \_pathauto_set_alias()
3 calls to _pathauto_set_alias()
pathauto_create_alias in ./pathauto.module
Apply patterns to create an alias
pathauto_create_index_alias in ./pathauto.module
_pathauto_update in ./pathauto.module
Makes updates to saved variables and the database structure.

File

./pathauto.module, line 417

Code

function _pathauto_set_alias($src, $dst, $pid = NULL, $verbose = FALSE, $oldalias = NULL) {

  // Alert users that an existing callback cannot be overridden automatically
  //
  if (_pathauto_path_is_callback($dst)) {
    if ($verbose and user_access('create url aliases')) {
      drupal_set_message(t('Ignoring alias ') . $dst . t(' due to existing path conflict'));
    }
    return;
  }

  // Skip replacing the current alias with an identical alias
  if ($oldalias != $dst) {
    path_set_alias($src, $dst, $pid, 1, 10);
    if ($verbose and user_access('create url aliases')) {
      if ($pid) {
        drupal_set_message(t('Created new alias %dst for %src, replacing %oldalias', array(
          '%dst' => $dst,
          '%src' => $src,
          '%oldalias' => $oldalias,
        )));
      }
      else {
        drupal_set_message(t('Created new alias %dst for %src', array(
          '%dst' => $dst,
          '%src' => $src,
        )));
      }
    }
  }
}