class AliasManager extends AliasManager implements AliasManagerInterface (View source)

The default alias manager implementation.

Traits

Provides a standard way to announce deprecated properties.

Properties

protected $deprecatedProperties {@inheritdoc} from  AliasManager
protected AliasRepositoryInterface $pathAliasRepository

The path alias repository.

from  AliasManager
protected CacheBackendInterface $cache

Cache backend service.

from  AliasManager
protected string $cacheKey

The cache key to use when caching paths.

from  AliasManager
protected bool $cacheNeedsWriting

Whether the cache needs to be written.

from  AliasManager
protected LanguageManagerInterface $languageManager

Language manager for retrieving the default langcode when none is specified.

from  AliasManager
protected array $lookupMap

Holds the map of path lookups per language.

from  AliasManager
protected array $noPath

Holds an array of aliases for which no path was found.

from  AliasManager
protected AliasWhitelistInterface $whitelist

Holds the array of whitelisted path aliases.

from  AliasManager
protected array $noAlias

Holds an array of paths that have no alias.

from  AliasManager
protected array $langcodePreloaded

Whether preloaded path lookups has already been loaded.

from  AliasManager
protected array $preloadedPathLookups

Holds an array of previously looked up paths for the current request path.

from  AliasManager

Methods

__get($name)

Allows to access deprecated/removed properties.

__construct(AliasRepositoryInterface $alias_repository, AliasWhitelistInterface $whitelist, LanguageManagerInterface $language_manager, CacheBackendInterface $cache)

Constructs an AliasManager.

setCacheKey($key)

Specify the key to use when writing the cache.

writeCache()

Write the cache.

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)

Clear internal caches in alias manager.

An
pathAliasWhitelistRebuild(string $path = NULL)

Rebuild the path alias white list.

int
getRequestTime()

Wrapper method for REQUEST_TIME constant.

Details

__get($name)

Allows to access deprecated/removed properties.

This method must be public.

Parameters

$name

__construct(AliasRepositoryInterface $alias_repository, AliasWhitelistInterface $whitelist, LanguageManagerInterface $language_manager, CacheBackendInterface $cache)

Constructs an AliasManager.

Parameters

AliasRepositoryInterface $alias_repository

The path alias repository.

AliasWhitelistInterface $whitelist

The whitelist implementation to use.

LanguageManagerInterface $language_manager

The language manager.

CacheBackendInterface $cache

Cache backend.

setCacheKey($key)

Specify the key to use when writing the cache.

Parameters

$key

writeCache()

Write the cache.

string getPathByAlias(string $alias, string $langcode = NULL)

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.

Exceptions

InvalidArgumentException

string getAliasByPath(string $path, string $langcode = NULL)

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.

Exceptions

InvalidArgumentException

cacheClear($source = NULL)

Clear internal caches in alias manager.

Parameters

$source

Source path of the alias that is being inserted/updated. Can be omitted if entire cache needs to be flushed.

protected An pathAliasWhitelistRebuild(string $path = NULL)

Rebuild the path alias white list.

Parameters

string $path

An optional path for which an alias is being inserted.

Return Value

An

array containing a white list of path aliases.

protected int getRequestTime()

Wrapper method for REQUEST_TIME constant.

Return Value

int