function drupal_get_path_alias

7.x path.inc drupal_get_path_alias($path = NULL, $path_language = NULL)
6.x path.inc drupal_get_path_alias($path, $path_language = '')

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.

$path_language: 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()
block_block_list_alter in drupal-7.x/modules/block/block.module
Implements hook_block_list_alter().
path_admin_overview in drupal-7.x/modules/path/path.admin.inc
Returns a listing of all defined URL aliases.
system_site_information_settings in drupal-7.x/modules/system/system.admin.inc
Form builder; The general site information form.
url in drupal-7.x/includes/common.inc
Generates an internal or external URL.
_shortcut_link_form_elements in drupal-7.x/modules/shortcut/shortcut.admin.inc
Helper function for building a form for adding or editing shortcut links.

... See full list

File

drupal-7.x/includes/path.inc, line 235
Functions to handle paths in Drupal, including path aliasing.

Code

function drupal_get_path_alias($path = NULL, $path_language = NULL) {
  // If no path is specified, use the current page's path.
  if ($path == NULL) {
    $path = $_GET['q'];
  }
  $result = $path;
  if ($alias = drupal_lookup_path('alias', $path, $path_language)) {
    $result = $alias;
  }
  return $result;
}