Copied!

Handler

Handler.php : 15
Interface

The Location Handler interface defines operations on Location elements in the storage engine.

Methods

publicchangeMainLocation()

Handler.php : 230

Changes main location of content identified by given $contentId to location identified by given $locationId.

public changeMainLocation(mixed $contentId, mixed $locationId) : mixed

Parameters

Name Type Default value Description
$contentId mixed - -
$locationId mixed - -

publiccopySubtree()

Handler.php : 112

Copy location object identified by $sourceId, into destination identified by $destinationParentId.

public copySubtree(mixed $sourceId, mixed $destinationParentId) : Location

Performs a deep copy of the location identified by $sourceId and all of its child locations, copying the most recent published content object for each location to a new content object without any additional version information. Relations for published version are copied. URLs are not touched at all.

Parameters

Name Type Default value Description
$sourceId mixed - -
$destinationParentId mixed - -

Return values

Location

the newly created Location.

Tags
Throws
NotFoundException

If $sourceId or $destinationParentId are invalid

publiccountAllLocations()

Handler.php : 237

Get the total number of all existing Locations. Can be combined with loadAllLocations.

public countAllLocations() : int

Return values

int

publiccountLocationsByContent()

Handler.php : 252

Counts locations for a given content represented by its id.

public countLocationsByContent(int $contentId) : int

Parameters

Name Type Default value Description
$contentId int - -

Return values

int

publiccreate()

Handler.php : 189

Creates a new location rooted at $location->parentId.

public create(CreateStruct $location) : Location

Parameters

Name Type Default value Description
$location CreateStruct - -

Return values

Location

Tags
Throws
NotFoundException

if parent Location does not exist

publicdeleteChildrenDrafts()

Handler.php : 209

Removes all draft contents that have no location assigned to them under the given parent location.

public deleteChildrenDrafts(int $locationId) : void

Parameters

Name Type Default value Description
$locationId int - -

publicgetSubtreeSize()

Handler.php : 114
public getSubtreeSize(string $path) : int

Parameters

Name Type Default value Description
$path string - -

Return values

int

publichide()

Handler.php : 135

Sets a location to be hidden, and it self + all children to invisible.

public hide(mixed $id) : mixed

Parameters

Name Type Default value Description
$id mixed -

Location ID

publicload()

Handler.php : 28

Loads the data for the location identified by $locationId.

public load(int $locationId[, array<string|int, string>|null $translations = null ][, bool $useAlwaysAvailable = true ]) : Location

Parameters

Name Type Default value Description
$locationId int - -
$translations array<string|int, string>|null null

If set, NotFound is thrown if content is not in given translation.

$useAlwaysAvailable bool true

Respect always available flag on content, where main language is valid translation fallback.

Return values

Location

Tags
Throws
NotFoundException

publicloadAllLocations()

Handler.php : 247

Bulk-load all existing Locations, constrained by $limit and $offset to paginate results.

public loadAllLocations(int $offset, int $limit) : array<string|int, Location>

Parameters

Name Type Default value Description
$offset int - -
$limit int - -

Return values

array<string|int, Location>

publicloadByRemoteId()

Handler.php : 66

Loads the data for the location identified by $remoteId.

public loadByRemoteId(string $remoteId[, array<string|int, string>|null $translations = null ][, bool $useAlwaysAvailable = true ]) : Location

Parameters

Name Type Default value Description
$remoteId string - -
$translations array<string|int, string>|null null

If set, NotFound is thrown if content is not in given translation.

$useAlwaysAvailable bool true

Respect always available flag on content, where main language is valid translation fallback.

Return values

Location

Tags
Throws
NotFoundException

publicloadList()

Handler.php : 42

Return list of unique Locations, with location id as key.

public loadList(array<string|int, int> $locationIds[, array<string|int, string>|null $translations = null ][, bool $useAlwaysAvailable = true ]) : array<string|int, Location>|iterable<string|int, mixed>

Missing items (NotFound) will be missing from the array and not cause an exception, it's up to calling logic to determine if this should cause exception or not.

Parameters

Name Type Default value Description
$locationIds array<string|int, int> - -
$translations array<string|int, string>|null null

If set, only locations with content in given translations are returned.

$useAlwaysAvailable bool true

Respect always available flag on content, where main language is valid translation fallback.

Return values

array<string|int, Location>|iterable<string|int, mixed>

publicloadLocationsByContent()

Handler.php : 77

Loads all locations for $contentId, optionally limited to a sub tree identified by $rootLocationId.

public loadLocationsByContent(int $contentId[, int $rootLocationId = null ]) : array<string|int, Location>

Parameters

Name Type Default value Description
$contentId int - -
$rootLocationId int null -

Return values

array<string|int, Location>

publicloadLocationsByTrashContent()

Handler.php : 85

Loads all locations for $contentId in trash, optionally limited to a sub tree identified by $rootLocationId.

public loadLocationsByTrashContent(int $contentId[, int|null $rootLocationId = null ]) : array<string|int, Location>

Parameters

Name Type Default value Description
$contentId int - -
$rootLocationId int|null null -

Return values

array<string|int, Location>

publicloadParentLocationsForDraftContent()

Handler.php : 95

Loads all parent Locations for unpublished Content by given $contentId.

public loadParentLocationsForDraftContent(mixed $contentId) : array<string|int, Location>

Parameters

Name Type Default value Description
$contentId mixed - -

Return values

array<string|int, Location>

publicloadSubtreeIds()

Handler.php : 53

Loads the subtree ids of the location identified by $locationId.

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

Parameters

Name Type Default value Description
$locationId int - -

Return values

array<string|int, mixed>

Location ids are in the index, Content ids in the value.

Tags
Throws
NotFoundException

publicmove()

Handler.php : 128

Moves location identified by $sourceId into new parent identified by $destinationParentId.

public move(mixed $sourceId, mixed $destinationParentId) : bool

Performs a full move of the location identified by $sourceId to a new destination, identified by $destinationParentId. Relations do not need to be updated, since they refer to Content. URLs are not touched.

Parameters

Name Type Default value Description
$sourceId mixed - -
$destinationParentId mixed - -

Return values

bool

publicremoveSubtree()

Handler.php : 204

Removes all Locations under and including $locationId.

public removeSubtree(mixed $locationId) : bool

Performs a recursive delete on the location identified by $locationId, including all of its child locations. Content which is not referred to by any other location is automatically removed. Content which looses its main Location will get the first of its other Locations assigned as the new main Location.

Parameters

Name Type Default value Description
$locationId mixed - -

Return values

bool

publicsetInvisible()

Handler.php : 150

Sets a location + all children to invisible.

public setInvisible(int $id) : void

Parameters

Name Type Default value Description
$id int -

Location ID

publicsetSectionForSubtree()

Handler.php : 222

Set section on all content objects in the subtree.

public setSectionForSubtree(mixed $locationId, mixed $sectionId) : mixed

Only main locations will be updated.

Parameters

Name Type Default value Description
$locationId mixed - -
$sectionId mixed - -

publicsetVisible()

Handler.php : 157

Sets a location + all children to visible.

public setVisible(int $id) : void

Parameters

Name Type Default value Description
$id int -

Location ID

publicswap()

Handler.php : 170

Swaps the content object being pointed to by a location object.

public swap(mixed $locationId1, mixed $locationId2) : bool

Make the location identified by $locationId1 refer to the Content referred to by $locationId2 and vice versa.

Parameters

Name Type Default value Description
$locationId1 mixed - -
$locationId2 mixed - -

Return values

bool

publicunHide()

Handler.php : 143

Sets a location to be unhidden, and self + children to visible unless a parent is hiding the tree.

public unHide(mixed $id) : mixed

If not make sure only children down to first hidden node is marked visible.

Parameters

Name Type Default value Description
$id mixed - -

publicupdate()

Handler.php : 178

Updates an existing location.

public update(UpdateStruct $location, int $locationId) : mixed

Parameters

Name Type Default value Description
$location UpdateStruct - -
$locationId int - -