1 path.api.php hook_path_is_alias_reserved($alias, $source, $langcode)

Determine if a possible URL alias would conflict with any existing paths.

Returning TRUE from this function will trigger path_alias_uniquify() to generate a similar URL alias with a suffix to avoid conflicts.


string $alias: The potential URL alias.

string $source: The source path for the alias (e.g. 'node/1').

string $langcode: The language code for the alias (e.g. 'en').

Return value

bool: TRUE if $alias conflicts with an existing, reserved path, or FALSE/NULL if it does not match any reserved paths.

See also



core/modules/path/path.api.php, line 176
Hooks provided by the Path module.


function hook_path_is_alias_reserved($alias, $source, $langcode) {
  // Check our module's list of paths and return TRUE if $alias matches any of
  // them.
  return (bool) db_query("SELECT 1 FROM {mytable} WHERE path = :path", array(':path' => $alias))->fetchField();