AliasManager
class AliasManager implements AliasManagerInterface (View source)
The default alias manager implementation.
Properties
| protected AliasRepositoryInterface | $pathAliasRepository | The path alias repository. |
|
| protected CacheBackendInterface | $cache | Cache backend service. |
|
| protected string | $cacheKey | The cache key to use when caching paths. |
|
| protected bool | $cacheNeedsWriting | Whether the cache needs to be written. |
|
| protected LanguageManagerInterface | $languageManager | Language manager for retrieving the default langcode when none is specified. |
|
| protected array | $lookupMap | Holds the map of path lookups per language. |
|
| protected array | $noPath | Holds an array of aliases for which no path was found. |
|
| protected AliasWhitelistInterface | $whitelist | Holds the array of whitelisted path aliases. |
|
| protected array | $noAlias | Holds an array of paths that have no alias. |
|
| protected array | $langcodePreloaded | Whether preloaded path lookups has already been loaded. |
|
| protected array | $preloadedPathLookups | Holds an array of previously looked up paths for the current request path. |
Methods
Constructs an AliasManager.
{@inheritdoc}
{@inheritdoc}
Given the alias, return the path it represents.
Given a path, return the alias.
Clears the static caches in alias manager and rebuilds the whitelist.
Rebuild the path alias white list.
Wrapper method for REQUEST_TIME constant.
Details
__construct(AliasRepositoryInterface $alias_repository, AliasWhitelistInterface $whitelist, LanguageManagerInterface $language_manager, CacheBackendInterface $cache)
Constructs an AliasManager.
setCacheKey($key)
{@inheritdoc}
writeCache()
{@inheritdoc}
Cache an array of the paths available on each page. We assume that aliases will be needed for the majority of these paths during subsequent requests, and load them in a single query during path alias lookup.
string
getPathByAlias(string $alias, string $langcode = NULL)
Given the alias, return the path it represents.
string
getAliasByPath(string $path, string $langcode = NULL)
Given a path, return the alias.
cacheClear($source = NULL)
Clears the static caches in alias manager and rebuilds the whitelist.
protected An
pathAliasWhitelistRebuild(string $path = NULL)
Rebuild the path alias white list.
protected int
getRequestTime()
Wrapper method for REQUEST_TIME constant.