You are here

function hook_pathauto_is_alias_reserved in Pathauto 7

Same name and namespace in other branches
  1. 8 pathauto.api.php \hook_pathauto_is_alias_reserved()

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

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

Parameters

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

pathauto_alias_uniquify()

2 functions implement hook_pathauto_is_alias_reserved()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

pathauto_pathauto_is_alias_reserved in ./pathauto.module
Implements hook_pathauto_is_alias_reserved().
path_pathauto_is_alias_reserved in ./pathauto.module
Implements hook_pathauto_is_alias_reserved() on behalf of path.module.
1 invocation of hook_pathauto_is_alias_reserved()
pathauto_is_alias_reserved in ./pathauto.module

File

./pathauto.api.php, line 138
Documentation for pathauto API.

Code

function hook_pathauto_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();
}