Community Documentation

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.

Parameters

$path: An internal Drupal path.

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_list in modules/block/block.module
Return all blocks in the specified region for the current user.
path_nodeapi in modules/path/path.module
Implementation of hook_nodeapi().
url in includes/common.inc
Generate a URL from a Drupal menu path. Will also pass-through existing URLs.
_statistics_link in modules/statistics/statistics.module
It is possible to adjust the width of columns generated by the statistics module.

File

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

Code

<?php
function drupal_get_path_alias($path) {
  $result = $path;
  if ($alias = drupal_lookup_path('alias', $path)) {
    $result = $alias;
  }
  if (function_exists('custom_url_rewrite')) {
    $result = custom_url_rewrite('alias', $result, $path);
  }
  return $result;
}
?>
Login or register to post comments