drupal_get_path_alias

Versions
4.6 – 5
drupal_get_path_alias($path)
6
drupal_get_path_alias($path, $path_language = '')
7
drupal_get_path_alias($path = NULL, $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.

▾ 4 functions call drupal_get_path_alias()

block_block_info_alter in modules/block/block.module
Implement hook_block_info_alter().
path_admin_overview in modules/path/path.admin.inc
Return a listing of all defined URL aliases.
url in includes/common.inc
Generate a URL.
_statistics_link in modules/statistics/statistics.module
It is possible to adjust the width of columns generated by the statistics module.

Code

includes/path.inc, line 188

<?php
function drupal_get_path_alias($path = NULL, $path_language = '') {
  // 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;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.