1 path.inc backdrop_get_normal_path($path, $langcode = NULL)

Given a URL alias, return the internal path it represents.

Parameters

$path: A Backdrop URL alias.

$langcode: An optional language code to look up the path in.

Return value

The internal path represented by the alias, or the original alias if no: internal path was found.

File

core/includes/path.inc, line 242
Functions to handle paths in Backdrop, including URL aliasing.

Code

function backdrop_get_normal_path($path, $langcode = NULL) {
  $original_path = $path;

  // Lookup the URL alias first.
  if ($source = backdrop_lookup_path('source', $path, $langcode)) {
    $path = $source;
  }

  // Allow other modules to alter the inbound URL. We cannot use backdrop_alter()
  // here because we need to run hook_url_inbound_alter() in the reverse order
  // of hook_url_outbound_alter().
  foreach (array_reverse(module_implements('url_inbound_alter')) as $module) {
    $function = $module . '_url_inbound_alter';
    $function($path, $original_path, $langcode);
  }

  return $path;
}