public function MockAliasManager::getPathByAlias in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/src/Tests/Routing/MockAliasManager.php \Drupal\system\Tests\Routing\MockAliasManager::getPathByAlias()
Given the alias, return the path it represents.
Parameters
string $alias: An alias.
string $langcode: An optional language code to look up the path in.
Return value
string The path represented by alias, or the alias if no path was found.
Throws
\InvalidArgumentException Thrown when the path does not start with a slash.
Overrides AliasManagerInterface::getPathByAlias
File
- core/
modules/ system/ src/ Tests/ Routing/ MockAliasManager.php, line 67
Class
- MockAliasManager
- An easily configurable mock alias manager.
Namespace
Drupal\system\Tests\RoutingCode
public function getPathByAlias($alias, $langcode = NULL) {
$langcode = $langcode ?: $this->defaultLanguage;
return $this->systemPaths[$alias][$langcode];
}