Handler
The UrlAlias Handler interface provides nice urls management.
Its methods operate on a representation of the url alias data structure held inside a storage engine.
Methods¶
archiveUrlAliasesForDeletedTranslations() ¶
Archive UrlAliases for Translations that were removed from the underlying published content.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$locationId | int | - |
Location of underlying published Content Object |
$parentLocationId | int | - | - |
$languageCodes | array<string|int, mixed> | - |
Language codes of currently published Content Object Translations |
createCustomUrlAlias() ¶
Create a user chosen $alias pointing to $locationId in $languageCode.
|
|
If $languageCode is null the $alias is created in the system's default language. $alwaysAvailable makes the alias available in all languages.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$locationId | mixed | - | - |
$path | string | - | - |
$forwarding | bool | false | - |
$languageCode | string|null | null | - |
$alwaysAvailable | bool | false | - |
Return values
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.
If $languageCode is null the $alias is created in the system's default language. $alwaysAvailable makes the alias available in all languages.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$resource | string | - | - |
$path | string | - | - |
$forwarding | bool | false | - |
$languageCode | string|null | null | - |
$alwaysAvailable | bool | false | - |
Return values
deleteCorruptedUrlAliases() ¶
Delete corrupted URL aliases (global, custom and system).
|
|
Return values
int
Number of deleted URL aliases
listGlobalURLAliases() ¶
List global aliases.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$languageCode | string|null | null | - |
$offset | int | 0 | - |
$limit | int | -1 | - |
Return values
array<string|int, UrlAlias>
Tags
listURLAliasesForLocation() ¶
List of url entries of $urlType, pointing to $locationId.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$locationId | mixed | - | - |
$custom | bool | false |
if true the user generated aliases are listed otherwise the autogenerated |
Return values
array<string|int, UrlAlias>
Tags
loadUrlAlias() ¶
Loads URL alias by given $id.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$id | string | - |
unique identifier in the form of "<parentId>-<text_md5>" |
Return values
Tags
locationCopied() ¶
Notifies the underlying engine that a location was copied.
|
|
This method triggers the creation of the autogenerated aliases for the copied locations
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$locationId | mixed | - | - |
$newLocationId | mixed | - | - |
$newParentId | mixed | - | - |
locationDeleted() ¶
Notifies the underlying engine that a location was deleted or moved to trash.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$locationId | mixed | - | - |
Return values
array<string|int, mixed>
locationMoved() ¶
Notifies the underlying engine that a location has moved.
|
|
This method triggers the change of the autogenerated aliases
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$locationId | mixed | - | - |
$oldParentId | mixed | - | - |
$newParentId | mixed | - | - |
locationSwapped() ¶
Notifies the underlying engine that a location was swapped.
|
|
This method triggers the change of the autogenerated aliases.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$location1Id | string|int | - | - |
$location1ParentId | string|int | - | - |
$location2Id | string|int | - | - |
$location2ParentId | string|int | - | - |
lookup() ¶
Looks up a url alias for the given url.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$url | string | - | - |
Return values
Tags
publishUrlAliasForLocation() ¶
This method creates or updates an urlalias from a new or changed content name in a language (if published). It also can be used to create an alias for a new location of content.
|
|
On update the old alias is linked to the new one (i.e. a history alias is generated).
$alwaysAvailable controls whether the url alias is accessible in all languages.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$locationId | mixed | - | - |
$parentLocationId | mixed | - | - |
$name | string | - |
the new name computed by the name schema or url alias schema |
$languageCode | string | - | - |
$alwaysAvailable | bool | false | - |
Return values
string
removeURLAliases() ¶
Removes url aliases.
|
|
Autogenerated aliases are not removed by this method.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$urlAliases | array<string|int, UrlAlias> | - | - |
Return values
bool
repairBrokenUrlAliasesForLocation() ¶
Attempt repairing auto-generated URL aliases for the given Location (including history).
|
|
Note: it is assumed that at this point original, working, URL Alias for Location is published.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$locationId | int | - | - |
Tags
translationRemoved() ¶
Notifies the underlying engine that Locations Content Translation was removed.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$locationIds | array<string|int, int> | - |
all Locations of the Content that got Translation removed |
$languageCode | string | - |
language code of the removed Translation |