function path_pathauto_is_alias_reserved in Pathauto 7
Implements hook_pathauto_is_alias_reserved() on behalf of path.module.
1 call to path_pathauto_is_alias_reserved()
- _pathauto_alias_exists in ./
pathauto.inc - Check to see if there is already an alias pointing to a different item.
File
- ./
pathauto.module, line 583 - Main file for the Pathauto module, which automatically generates aliases for content.
Code
function path_pathauto_is_alias_reserved($alias, $source, $langcode) {
// For language neutral content, we need to make sure the alias doesn't
// collide with any existing aliases. For localized content, just make sure
// it doesn't collide with same language or language neutral aliases.
if ($langcode != LANGUAGE_NONE) {
return (bool) db_query("SELECT 1 FROM {url_alias} WHERE source <> :source AND alias = :alias AND language IN (:langcodes)", array(
':source' => $source,
':alias' => $alias,
':langcodes' => array(
$langcode,
LANGUAGE_NONE,
),
))
->fetchField();
}
else {
return (bool) db_query("SELECT 1 FROM {url_alias} WHERE source <> :source AND alias = :alias", array(
':source' => $source,
':alias' => $alias,
))
->fetchField();
}
}