1.20.x path.inc backdrop_get_path_alias($path = NULL, $langcode = NULL)

Given an internal Backdrop 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 Backdrop 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.

File

includes/path.inc, line 219
Functions to handle paths in Backdrop, including path aliasing.

Code

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