URLAliasService
URLAlias service.
Methods¶
createGlobalUrlAlias() ¶
Create a user chosen $alias pointing to a resource in $languageCode.
|
|
This method does not handle location resources - if a user enters a location target the createCustomUrlAlias method has to be used. This method runs URL filters and and transformers before storing them. Hence the path returned in the URLAlias Value may differ from the given.
$alwaysAvailable makes the alias available in all languages.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$resource | string | - | - |
$path | string | - | - |
$languageCode | string | - | - |
$forwarding | bool | false | - |
$alwaysAvailable | bool | false | - |
Return values
Tags
createUrlAlias() ¶
Create a user chosen $alias pointing to $location in $languageCode.
|
This method runs URL filters and transformers before storing them. Hence the path returned in the URLAlias Value may differ from the given. $alwaysAvailable makes the alias available in all languages.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$location | Location | - | - |
$path | string | - | - |
$languageCode | string | - |
the languageCode for which this alias is valid |
$forwarding | bool | false |
if true a redirect is performed |
$alwaysAvailable | bool | false | - |
Return values
Tags
deleteCorruptedUrlAliases() ¶
Delete global, system or custom URL alias pointing to non-existent Locations.
|
|
Return values
int
Number of deleted URL aliases
listGlobalAliases() ¶
List global aliases.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$languageCode | string|null | null |
filters those which are valid for the given language |
$offset | int | 0 | - |
$limit | int | -1 | - |
Return values
array<string|int, URLAlias>
listLocationAliases() ¶
List of url aliases pointing to $location, sorted by language priority.
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$location | Location | - | - |
$custom | bool | true |
if true the user generated aliases are listed otherwise the autogenerated |
$languageCode | string|null | null |
filters those which are valid for the given language |
$showAllTranslations | bool|null | null |
If enabled will include all alias as if they where always available. |
$prioritizedLanguages | array<string|int, string>|null | null |
If set used as prioritized language codes, returning first match. |
Return values
array<string|int, URLAlias>
load() ¶
Loads URL alias by given $id.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$id | string | - | - |
Return values
Tags
lookup() ¶
looks up the URLAlias for the given url.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$url | string | - | - |
$languageCode | string|null | null | - |
Return values
Tags
refreshSystemUrlAliasesForLocation() ¶
Refresh all system URL aliases for the given Location (and historize outdated if needed).
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$location | Location | - | - |
removeAliases() ¶
Removes urls aliases.
|
|
This method does not remove autogenerated aliases for locations.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$aliasList | array<string|int, URLAlias> | - | - |
Tags
reverseLookup() ¶
Returns the URL alias for the given location in the given language.
|
If $languageCode is null the method returns the url alias in the most prioritized language.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$location | Location | - | - |
$languageCode | string|null | null |
filters those which are valid for the given language |
$showAllTranslations | bool|null | null |
If enabled will include all alias as if they where always available. |
$prioritizedLanguages | array<string|int, string>|null | null |
If set used as prioritized language codes, returning first match. |