function AliasManagerInterface::getAliasByPath

Same name in other branches
  1. 9 core/modules/path_alias/src/AliasManagerInterface.php \Drupal\path_alias\AliasManagerInterface::getAliasByPath()
  2. 10 core/modules/path_alias/src/AliasManagerInterface.php \Drupal\path_alias\AliasManagerInterface::getAliasByPath()
  3. 11.x core/modules/path_alias/src/AliasManagerInterface.php \Drupal\path_alias\AliasManagerInterface::getAliasByPath()

Given a path, return the alias.

Parameters

string $path: A path.

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

Return value

string An alias that represents the path, or path if no alias was found.

Throws

\InvalidArgumentException Thrown when the path does not start with a slash.

3 methods override AliasManagerInterface::getAliasByPath()
AliasManager::getAliasByPath in core/lib/Drupal/Core/Path/AliasManager.php
Given a path, return the alias.
AliasManagerDecorator::getAliasByPath in core/modules/path_alias/tests/modules/path_alias_deprecated_test/src/AliasManagerDecorator.php
Given a path, return the alias.
NewAliasManager::getAliasByPath in core/modules/path_alias/tests/modules/path_alias_deprecated_test/src/NewAliasManager.php
Given a path, return the alias.

File

core/lib/Drupal/Core/Path/AliasManagerInterface.php, line 45

Class

AliasManagerInterface
Find an alias for a path and vice versa.

Namespace

Drupal\Core\Path

Code

public function getAliasByPath($path, $langcode = NULL);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.