drupal_get_path_alias

5 path.inc drupal_get_path_alias($path)
6 path.inc drupal_get_path_alias($path, $path_language = '')
7 path.inc drupal_get_path_alias($path = NULL, $path_language = NULL)
8 path.inc drupal_get_path_alias($path = NULL, $langcode = NULL)

Given an internal Drupal path, return the alias set by the administrator.

If no path is provided, the function will return the alias of the current page.

Parameters

$path: An internal Drupal path.

$langcode: An optional language code to look up the path in.

Return value

An aliased path if one was found, or the original path if no alias was found.

6 calls to drupal_get_path_alias()

File

core/includes/path.inc, line 243
Functions to handle paths in Drupal, including path aliasing.

Code

function drupal_get_path_alias($path = NULL, $langcode = NULL) {
  // If no path is specified, use the current page's path.
  if ($path == NULL) {
    $path = current_path();
  }
  $result = $path;
  if ($alias = drupal_lookup_path('alias', $path, $langcode)) {
    $result = $alias;
  }
  return $result;
}
Login or register to post comments