Handler
The Location Handler interface defines operations on Location elements in the storage engine.
Methods¶
changeMainLocation()
¶
Changes main location of content identified by given $contentId to location identified by given $locationId.
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $contentId | mixed | - | - |
| $locationId | mixed | - | - |
copySubtree()
¶
Copy location object identified by $sourceId, into destination identified by $destinationParentId.
|
|
|
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
the newly created Location.
Tags
countAllLocations()
¶
Get the total number of all existing Locations. Can be combined with loadAllLocations.
|
|
|
Return values
int
countLocationsByContent()
¶
Counts locations for a given content represented by its id.
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $contentId | int | - | - |
Return values
int
create()
¶
Creates a new location rooted at $location->parentId.
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $location | CreateStruct | - | - |
Return values
Tags
deleteChildrenDrafts()
¶
Removes all draft contents that have no location assigned to them under the given parent location.
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $locationId | int | - | - |
getSubtreeSize()
¶
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $path | string | - | - |
Return values
int
hide()
¶
Sets a location to be hidden, and it self + all children to invisible.
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $id | mixed | - |
Location ID |
load()
¶
Loads the data for the location identified by $locationId.
|
|
|
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
Tags
loadAllLocations()
¶
Bulk-load all existing Locations, constrained by $limit and $offset to paginate results.
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $offset | int | - | - |
| $limit | int | - | - |
Return values
array<string|int, Location>
loadByRemoteId()
¶
Loads the data for the location identified by $remoteId.
|
|
|
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
Tags
loadList()
¶
Return list of unique Locations, with location id as key.
|
|
|
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>
loadLocationsByContent()
¶
Loads all locations for $contentId, optionally limited to a sub tree identified by $rootLocationId.
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $contentId | int | - | - |
| $rootLocationId | int | null | - |
Return values
array<string|int, Location>
loadLocationsByTrashContent()
¶
Loads all locations for $contentId in trash, optionally limited to a sub tree identified by $rootLocationId.
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $contentId | int | - | - |
| $rootLocationId | int|null | null | - |
Return values
array<string|int, Location>
loadParentLocationsForDraftContent()
¶
Loads all parent Locations for unpublished Content by given $contentId.
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $contentId | mixed | - | - |
Return values
array<string|int, Location>
loadSubtreeIds()
¶
Loads the subtree ids of the location identified by $locationId.
|
|
|
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
markSubtreeModified()
¶
Marks the given nodes and all ancestors as modified.
|
|
|
Optionally a time stamp with the modification date may be specified, otherwise the current time is used.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $locationId | int|string | - | - |
| $timestamp | int | null | - |
Tags
move()
¶
Moves location identified by $sourceId into new parent identified by $destinationParentId.
|
|
|
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
removeSubtree()
¶
Removes all Locations under and including $locationId.
|
|
|
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
setInvisible()
¶
Sets a location + all children to invisible.
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $id | int | - |
Location ID |
setSectionForSubtree()
¶
Set section on all content objects in the subtree.
|
|
|
Only main locations will be updated.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $locationId | mixed | - | - |
| $sectionId | mixed | - | - |
setVisible()
¶
Sets a location + all children to visible.
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $id | int | - |
Location ID |
swap()
¶
Swaps the content object being pointed to by a location object.
|
|
|
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
unHide()
¶
Sets a location to be unhidden, and self + children to visible unless a parent is hiding the tree.
|
|
|
If not make sure only children down to first hidden node is marked visible.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $id | mixed | - | - |
update()
¶
Updates an existing location.
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $location | UpdateStruct | - | - |
| $locationId | int | - | - |