Collection
class Collection extends ConcreteObject implements TrackableInterface (View source)
Properties
$error | from ConcreteObject | ||
int|null deprecated | $cID | The collection ID. |
|
protected Version|null | $vObj | The collection version object. |
|
protected string|null | $cHandle | The collection handle. |
|
protected string|null | $cDateAdded | The date/time when the collection has been created. |
|
protected string|null | $cDateModified | The date/time when the collection was last modified. |
|
protected array | $attributes |
Methods
Destruct the class instance.
Get a collection by ID.
Get a Collection by handle (provided that it's not a Page handle).
(Re)Index all the collections that are marked as to be (re)indexed.
Create a new Collection instance.
Get the collection ID.
Get the collection handle.
Get the date/time when the collection was last modified.
Get the date/time when the collection has been created.
Get the ID of the currently loaded version.
Get the currently loaded version object.
Create a new Collection instance, using the same theme as this instance (if it's a Page instance).
Load a specific collection version (you can retrieve it with the getVersionObject() method).
Get the Collection instance to be modified (this instance if it's a new or master Collection, a clone otherwise).
Get the automatic comment for the next collection version.
No description
Set the attribute value for the currently loaded collection version.
Return the value of the attribute with the handle $akHandle of the currently loaded version (if it's loaded).
Return the attribute value object with the handle $akHandle of the currently loaded version (if it's loaded).
Delete the values of the attributes associated to the currently loaded collection version.
Delete the value of a specific attribute key associated to the currently loaded collection version.
Get the list of attribute keys for which the currently loaded collection version has values.
Does this collection contain blocks that are aliased in other pages?
Get the custom style of an area in the currently loaded collection version.
Set the custom style of an area in the currently loaded collection version.
Delete all the custom styles of an area of the currently loaded collection version.
Retrieve all custom style rules that should be inserted into the header on a page, whether they are defined in areas or blocks.
Returns the ID of the page/collection type.
Empty the collection-related cache.
Get the blocks contained in all the global areas in this collection.
Get the IDs for blocks contained in all the global areas in this collection.
Get all the global stacks loaded in this collection.
List the blocks in the currently loaded collection version (or in a specific area within it).
List the block IDs and the associated area handles in the currently loaded collection version (or in a specific area within it).
Get the next value of the display order (to be used when adding new blocks to an area).
Fix the display order properties for all the blocks within the collection/area.
Fix the display order properties for all the blocks after this block in this area.
Update the last edit date/time.
Delete this collection, and all its versions, contents and attributes.
Create a clone of this collection, and all its versions, contents and attributes.
Clone the currently loaded version and returns a Page instance containing the new version.
Details
loadError($error)
No description
isError()
No description
getError()
No description
setPropertiesFromArray($arr)
No description
static
camelcase($file)
No description
static
uncamelcase($string)
No description
__destruct()
Destruct the class instance.
static Collection
getByID(int $cID, string|int|false $version = 'RECENT')
Get a collection by ID.
static Collection|null
getByHandle(string $handle)
Get a Collection by handle (provided that it's not a Page handle).
If there's there's no collection with the specified handle, a new Collection will be created.
static int
reindexPendingPages()
(Re)Index all the collections that are marked as to be (re)indexed.
static Collection
createCollection(array $data)
Create a new Collection instance.
int|null
getCollectionID()
Get the collection ID.
string|null
getCollectionHandle()
Get the collection handle.
string|null
getCollectionDateLastModified()
Get the date/time when the collection was last modified.
string|null
getCollectionDateAdded()
Get the date/time when the collection has been created.
int
getVersionID()
Get the ID of the currently loaded version.
Version|null
getVersionObject()
Get the currently loaded version object.
Collection
addCollection(array $data)
Create a new Collection instance, using the same theme as this instance (if it's a Page instance).
loadVersionObject(string|int $cvID = 'ACTIVE')
Load a specific collection version (you can retrieve it with the getVersionObject() method).
$this|Page
getVersionToModify()
Get the Collection instance to be modified (this instance if it's a new or master Collection, a clone otherwise).
string
getNextVersionComments()
Get the automatic comment for the next collection version.
reindex()
No description
PageValue
setAttribute(string|CollectionKey $ak, AbstractValue|mixed $value, bool $doReindexImmediately = true)
Set the attribute value for the currently loaded collection version.
mixed|null
getAttribute(string|CollectionKey $akHandle, string|false $displayMode = false)
Return the value of the attribute with the handle $akHandle of the currently loaded version (if it's loaded).
PageValue|null
getAttributeValueObject(string|CollectionKey $akHandle, bool $createIfNotExists = false)
Return the attribute value object with the handle $akHandle of the currently loaded version (if it's loaded).
clearCollectionAttributes(int[] $retainAKIDs = [])
Delete the values of the attributes associated to the currently loaded collection version.
clearAttribute(string|CollectionKey $ak, bool $doReindexImmediately = true)
Delete the value of a specific attribute key associated to the currently loaded collection version.
PageKey[]
getSetCollectionAttributes()
Get the list of attribute keys for which the currently loaded collection version has values.
Area|null
getArea(string $arHandle)
Get an existing area associated to this collection.
bool
hasAliasedContent()
Does this collection contain blocks that are aliased in other pages?
CustomStyle|null
getAreaCustomStyle(Area $area, bool $force = false)
Get the custom style of an area in the currently loaded collection version.
setCustomStyleSet(Area $area, StyleSet $set)
Set the custom style of an area in the currently loaded collection version.
resetAreaCustomStyle(Area $area)
Delete all the custom styles of an area of the currently loaded collection version.
string|null
outputCustomStyleHeaderItems(bool $return = false)
Retrieve all custom style rules that should be inserted into the header on a page, whether they are defined in areas or blocks.
null|false
relateVersionEdits(Collection $oc)
Associate the edits of another collection to this collection.
int|false
getPageTypeID()
Returns the ID of the page/collection type.
refreshCache()
Empty the collection-related cache.
Block[]
getGlobalBlocks()
Get the blocks contained in all the global areas in this collection.
array
getGlobalBlockIDs()
Get the IDs for blocks contained in all the global areas in this collection.
protected Stack[]
getGlobalStacksForCollection()
Get all the global stacks loaded in this collection.
Block[]
getBlocks(string|false $arHandle = false)
List the blocks in the currently loaded collection version (or in a specific area within it).
array
getBlockIDs(string|false $arHandle = false)
List the block IDs and the associated area handles in the currently loaded collection version (or in a specific area within it).
Block
addBlock(BlockType $bt, string|Area $a, array $data)
Add a new block to a specific area of the currently loaded collection version.
int
getCollectionAreaDisplayOrder(string $arHandle, bool $ignoreVersions = false)
Get the next value of the display order (to be used when adding new blocks to an area).
rescanDisplayOrder(string $arHandle)
Fix the display order properties for all the blocks within the collection/area.
void
rescanDisplayOrderFromBlock(Block $block, string $arHandle, int $fromDisplay = null)
Fix the display order properties for all the blocks after this block in this area.
This is useful for forcing a certain block order.
markModified()
Update the last edit date/time.
delete()
Delete this collection, and all its versions, contents and attributes.
Collection
duplicateCollection()
Create a clone of this collection, and all its versions, contents and attributes.
Page
cloneVersion(string|null $versionComments, bool $createEmpty = false)
Clone the currently loaded version and returns a Page instance containing the new version.
PageValue|null
getAttributeValue(string|CollectionKey $ak)
deprecated
deprecated
No description
mixed|null
getCollectionAttributeValue(string|CollectionKey $akHandle)
deprecated
deprecated
No description
getCollectionTypeID()
deprecated
deprecated
No description