public function AliasManager::getPathAlias

Implements \Drupal\Core\Path\AliasManagerInterface::getPathAlias().

Overrides AliasManagerInterface::getPathAlias

File

drupal/core/lib/Drupal/Core/Path/AliasManager.php, line 112
Contains Drupal\Core\Path\AliasManager.

Class

AliasManager

Namespace

Drupal\Core\Path

Code

public function getPathAlias($path, $path_language = NULL) {

  // If no language is explicitly specified we default to the current URL
  // language. If we used a language different from the one conveyed by the
  // requested URL, we might end up being unable to check if there is a path
  // alias matching the URL path.
  $path_language = $path_language ?: $this->langcode;
  $result = $path;
  if (!empty($path) && ($alias = $this
    ->lookupPathAlias($path, $path_language))) {
    $result = $alias;
  }
  return $result;
}