Copied!

Handler

Handler.php : 15

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

publicarchiveUrlAliasesForDeletedTranslations()

Handler.php : 191

Archive UrlAliases for Translations that were removed from the underlying published content.

public archiveUrlAliasesForDeletedTranslations(int $locationId, int $parentLocationId, array<string|int, mixed> $languageCodes) : mixed

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

publiccreateCustomUrlAlias()

Handler.php : 53

Create a user chosen $alias pointing to $locationId in $languageCode.

public createCustomUrlAlias(mixed $locationId, string $path[, bool $forwarding = false ][, string|null $languageCode = null ][, bool $alwaysAvailable = false ]) : UrlAlias

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

UrlAlias

publiccreateGlobalUrlAlias()

Handler.php : 71

Create a user chosen $alias pointing to a resource in $languageCode.

public createGlobalUrlAlias(string $resource, string $path[, bool $forwarding = false ][, string|null $languageCode = null ][, bool $alwaysAvailable = false ]) : UrlAlias

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

UrlAlias

publicdeleteCorruptedUrlAliases()

Handler.php : 198

Delete corrupted URL aliases (global, custom and system).

public deleteCorruptedUrlAliases() : int

Return values

int

Number of deleted URL aliases

publiclistGlobalURLAliases()

Handler.php : 84

List global aliases.

public listGlobalURLAliases([string|null $languageCode = null ][, int $offset = 0 ][, int $limit = -1 ]) : array<string|int, UrlAlias>

Parameters

Name Type Default value Description
$languageCode string|null null -
$offset int 0 -
$limit int -1 -

Return values

array<string|int, UrlAlias>

Tags
Throws
BadStateException

if path for any of the global URL aliases is broken

publiclistURLAliasesForLocation()

Handler.php : 96

List of url entries of $urlType, pointing to $locationId.

public listURLAliasesForLocation(mixed $locationId[, bool $custom = false ]) : array<string|int, UrlAlias>

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
Throws
BadStateException

if any path for the Location is broken

publicloadUrlAlias()

Handler.php : 131

Loads URL alias by given $id.

public loadUrlAlias(string $id) : UrlAlias

Parameters

Name Type Default value Description
$id string -

unique identifier in the form of "<parentId>-<text_md5>"

Return values

UrlAlias

Tags
Throws
BadStateException

if path for the given URL alias is broken

publiclocationCopied()

Handler.php : 153

Notifies the underlying engine that a location was copied.

public locationCopied(mixed $locationId, mixed $newLocationId, mixed $newParentId) : mixed

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 - -

publiclocationDeleted()

Handler.php : 174

Notifies the underlying engine that a location was deleted or moved to trash.

public locationDeleted(mixed $locationId) : array<string|int, mixed>

Parameters

Name Type Default value Description
$locationId mixed - -

Return values

array<string|int, mixed>

publiclocationMoved()

Handler.php : 142

Notifies the underlying engine that a location has moved.

public locationMoved(mixed $locationId, mixed $oldParentId, mixed $newParentId) : mixed

This method triggers the change of the autogenerated aliases

Parameters

Name Type Default value Description
$locationId mixed - -
$oldParentId mixed - -
$newParentId mixed - -

publiclocationSwapped()

Handler.php : 165

Notifies the underlying engine that a location was swapped.

public locationSwapped(string|int $location1Id, string|int $location1ParentId, string|int $location2Id, string|int $location2ParentId) : mixed

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 - -

publiclookup()

Handler.php : 120

Looks up a url alias for the given url.

public lookup(string $url) : UrlAlias

Parameters

Name Type Default value Description
$url string - -

Return values

UrlAlias

Tags
Throws
NotFoundException
Throws
InvalidArgumentException
Throws
BadStateException

if the stored path for the given URL is broken

publicpublishUrlAliasForLocation()

Handler.php : 31

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.

public publishUrlAliasForLocation(mixed $locationId, mixed $parentLocationId, string $name, string $languageCode[, bool $alwaysAvailable = false ]) : string

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

publicremoveURLAliases()

Handler.php : 107

Removes url aliases.

public removeURLAliases(array<string|int, UrlAlias$urlAliases) : bool

Autogenerated aliases are not removed by this method.

Parameters

Name Type Default value Description
$urlAliases array<string|int, UrlAlias> - -

Return values

bool

publicrepairBrokenUrlAliasesForLocation()

Handler.php : 209

Attempt repairing auto-generated URL aliases for the given Location (including history).

public repairBrokenUrlAliasesForLocation(int $locationId) : mixed

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
Throws
BadStateException

publictranslationRemoved()

Handler.php : 182

Notifies the underlying engine that Locations Content Translation was removed.

public translationRemoved(array<string|int, int> $locationIds, string $languageCode) : mixed

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