On this page
function drupal_get_path_alias
drupal_get_path_alias($path = NULL, $path_language = 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.
$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.
File
- 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;
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!path.inc/function/drupal_get_path_alias/7.x