function MockAliasManager::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.
Overrides AliasManagerInterface::getAliasByPath
File
- 
              core/modules/ system/ src/ Tests/ Routing/ MockAliasManager.php, line 77 
Class
- MockAliasManager
- An easily configurable mock alias manager.
Namespace
Drupal\system\Tests\RoutingCode
public function getAliasByPath($path, $langcode = NULL) {
  if ($path[0] !== '/') {
    throw new \InvalidArgumentException(sprintf('Source path %s has to start with a slash.', $path));
  }
  $langcode = $langcode ?: $this->defaultLanguage;
  $this->lookedUp[$path] = 1;
  return $this->aliases[$path][$langcode];
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
