ModelCommon module

GlobalComponent

A model in the Common module, with 58 members for templates, 26 API properties and 64 members for admin templates.

View
What Smarty and Twig templates receive. Properties in REST API responses and job payloads. What admin screen templates receive when you override them.

Templates view

Properties 29

Take no arguments.

# isLocal()
bool
Returns the information that this is not a local component
# isGlobal()
bool
Returns the information that this is a global component
# isBlank()
bool
Returns the information that this is not a blank component
# getAreas()
?Collection
Get the layout areas this component is associated with
# getAreaGroups()
?Collection
Gets the layout area groups this component is associated with
# getComponentAreas()
Collection
Get the component areas from the active revision Uses the active revision of the global component.
# isUsedInContent()
bool
Check if the component is used in content
# getNumUsedInContent()
int
Determine how often this global component has been used in the content (or component collections)
# getAssignedWorkflow()
?Workflow
Get the workflow assigned to the record or entity
# hasAssignedWorkflow()
bool
Check whether the record has an assigned workflow
# getBranches()
Collection
Get the branches associated with the record
# getNumRevisionsWithoutBranch()
int
Get the number of revisions without branch
# getId()
?int
# getName()
?string
# getIdentifier()
?string
# getLayout()
?Layout
# getCreated()
?DateTime
Get the date the record was created.
# getModified()
?DateTime
Get the last modification date for the record.
# getHidden()
?DateTime
# getSite()
?Site
# getActiveRevision()
?GlobalComponentRevision
# getLastRevision()
?GlobalComponentRevision
Get the last revision for the entity. If a revision has been added, this will be the newly added revision.
# getCopiedComponents()
?Collection<Component>
# getTags()
?Collection<Tag>
# getCategories()
?Collection<Category>
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned

Methods 29

Take arguments. The API serialises only getters that need none.

# getHtml(array $variables)
string
Get the rendered html content for this component. Uses the active revision of the global component.
# getAreaType(string $areaName)
?InputType
Get the input type for the specified layout area, using the active revision of the record. Returns null if the area with the specified name could not be found.
# getAreaCategory(string $areaName)
?string
Get the category for the specified layout area, using the active revision of the record. Returns null if the area with the specified name could not be found.
# getAreaEditor(string $areaName)
?string
Get the editor for the specified layout area, using the active revision of the record. Returns null if the area with the specified name could not be found.
# getAreaImage(string $areaName)
?Image
Get the image for the layout area with the specified name, using the active revision of the record
# getAreaRecord(string $areaName)
?Model
Get the record for the layout area with the specified name, using the active revision of the record
# getAreaRecords(string $areaName)
?Collection
Get the records for the layout area with the specified name, using the active revision of the record
# getAreaText(string $areaName)
?string
Get the text for the layout area with the specified name, using the active revision of the record
# getAreaValues(string $areaName)
array
Get the values for the layout area with the specified name, using the active revision of the record
# getAreaHtml(string $areaName)
string
Get the rendered HTML for the component area with the specified name, using the active revision of the record. Adds live preview tags, if enabled.
# getAreaDate(string $areaName)
?DateTime
Get a date for the layout area with the specified name, using the active revision of the record
# getAreaWidget(string $areaName)
?Widget
Get the widget for the layout area with the specified name, using the active revision of the record
# getAreaComponent(string $areaName)
?Component
Get the component for the layout area with the specified name, using the active revision of the record
# getAreaCollectionElements(string $areaName)
?Collection
Get the component collection elements for the layout area with the specified name, using the active revision of the record
# getAreaContent(string $areaName)
?Content
Get the content of the component area Uses the active revision of the global component.
# getAreaDefaultContent(string $areaName)
?Content
Get the default content of the layout area. Uses the active revision of the global component. Will return a BlankContent if no content was defined.
# getAreaContentOrDefault(string $areaName)
?Content
Get the content of the layout area, or the default content if no content exists. Uses the active revision of the global component. If no default content exists, a BlankContent will be returned.
# isAreaBlank(string $areaName)
bool
Check whether the layout area with the specified name has no usable content, using the active revision of the record. Reports the area as blank when the record has no active revision. Blank describes what is stored, not what renders: the answer comes from the stored content and never renders a template. An area can therefore be not blank and still render nothing — a record that was deleted or has no layout, a component or widget whose template outputs nothing, or text whose only content is a placeholder for a deleted image. To decide on the rendered output instead, test the result of getAreaHtml().
# getAreaAttributesContent(string $areaName)
array
Gets the content of every layout area attribute. If layout area does not have attributes, returns empty array. Uses the active revision of the global component.
# getAreaAttributesDefaultContent(string $areaName)
array
Gets the default content of every layout area attribute. If layout area does not have attributes, returns empty array. Uses the active revision of the global component.
# getAreaAttributesContentOrDefault(string $areaName)
array
Gets the content (or the default content if no content exists) of every layout area attribute. If layout area does not have attributes, returns empty array. Uses the active revision of the global component.
# getEntityAreaByLayoutArea(LayoutArea $area)
?Model
Get the link record between the layout area and content for the designated layout area. Uses the active revision of the global component.
# getBranchRevisions(RevisionBranch $branch, ?int $limit, ?int $offset)
Collection
Get the revisions for the provided branch, ordered by id ascending. Pass a limit/offset to fetch a bounded window instead of the full set — loading all revisions of a large branch exhausts memory.
# getNumBranchRevisions(RevisionBranch $branch)
int
Get the number of revisions for the provided branch (COUNT query — does not hydrate)
# getRevisionsWithoutBranch(?int $limit, ?int $offset)
Collection
Get the revisions without branch, ordered by id ascending. Pass a limit/offset to fetch a bounded window instead of the full set — loading all revisions of a record with a large history exhausts memory.
# getRevisionById(int $id)
?GlobalComponentRevision
Get the revision with the specified id
# hasAreaWithName(string $areaName) Templates only
bool
Check if an area with the specified name exists for the active revision of the record
# getAreaImageOrPlaceholder(string $areaName, int $width, int $height) Templates only
Image
Get the image for the component area with the specified name. Uses the active revision of the global component. If the image does not exist, get a placeholder image with the specified dimensions Will always return an image, even if it was not found (in that case, an empty image).
# getAreaFile(string $areaName) Templates only
?File
Get the file for the layout area with the specified name, using the active revision of the record

API & Jobs view

API & JobsEach property is a key in REST API responses and job payloads. Its name is the template getter without get, is or has. Methods that need arguments are not available here.

Properties 26

Read-only values on the record.

# local
bool
Returns the information that this is not a local component
# global
bool
Returns the information that this is a global component
# blank
bool
Returns the information that this is not a blank component
# areas
?Collection
Get the layout areas this component is associated with
# areaGroups
?Collection
Gets the layout area groups this component is associated with
# componentAreas
Collection
Get the component areas from the active revision Uses the active revision of the global component.
# usedInContent
bool
Check if the component is used in content
# numUsedInContent
int
Determine how often this global component has been used in the content (or component collections)
# assignedWorkflow
?Workflow
Get the workflow assigned to the record or entity
# assignedWorkflow
bool
Check whether the record has an assigned workflow
# branches
Collection
Get the branches associated with the record
# numRevisionsWithoutBranch
int
Get the number of revisions without branch
# id
?int
# name
?string
# identifier
?string
# layout
?Layout
# created
?DateTime
Get the date the record was created.
# modified
?DateTime
Get the last modification date for the record.
# hidden
?DateTime
# site
?Site
# activeRevision
?GlobalComponentRevision
# lastRevision
?GlobalComponentRevision
Get the last revision for the entity. If a revision has been added, this will be the newly added revision.
# copiedComponents
?Collection<Component>
# tags
?Collection<Tag>
# categories
?Collection<Category>

Admin view

AdminAvailable in cdna-admin templates. Copy an admin template into your site repository to change how this record is edited.

Properties 34

Take no arguments.

# isLocal()
bool
Returns the information that this is not a local component
# isGlobal()
bool
Returns the information that this is a global component
# isBlank()
bool
Returns the information that this is not a blank component
# getAreas()
?Collection
Get the layout areas this component is associated with
# getAreaGroups()
?Collection
Gets the layout area groups this component is associated with
# getComponentAreas()
Collection
Get the component areas from the active revision Uses the active revision of the global component.
# isUsedInContent()
bool
Check if the component is used in content
# getNumUsedInContent()
int
Determine how often this global component has been used in the content (or component collections)
# isSupportingBranches() Admin only
bool
Checks whether the record supports branches
# getAssignedWorkflow()
?Workflow
Get the workflow assigned to the record or entity
# hasAssignedWorkflow()
bool
Check whether the record has an assigned workflow
# getBranches()
Collection
Get the branches associated with the record
# getNumRevisionsWithoutBranch()
int
Get the number of revisions without branch
# getId()
?int
# getName()
?string
# getIdentifier()
?string
# getLayout()
?Layout
# getCreated()
?DateTime
Get the date the record was created.
# getModified()
?DateTime
Get the last modification date for the record.
# getHidden()
?DateTime
# getSite()
?Site
# getActiveRevision()
?GlobalComponentRevision
# getLastRevision()
?GlobalComponentRevision
Get the last revision for the entity. If a revision has been added, this will be the newly added revision.
# getCopiedComponents()
?Collection<Component>
# getTags()
?Collection<Tag>
# getCategories()
?Collection<Category>
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned
# getAvailableSaveNewActions() Admin only
array
Get the actions available for saving a new version of the record. Determined whether an active revision can be set directly, and in which order the actions should be returned.
# getEditUrl() Admin only
?string
Get the url for editing the record.
# getManageUrl() Admin only
?string
Get the url for managing records.

Methods 30

Take arguments. The API serialises only getters that need none.

# getHtml(array $variables)
string
Get the rendered html content for this component. Uses the active revision of the global component.
# getAreaType(string $areaName)
?InputType
Get the input type for the specified layout area. Returns null if the area with the specified name could not be found. Uses the active revision of the global component.
# getAreaCategory(string $areaName)
?string
Get the category for the specified layout area. Returns null if the area with the specified name could not be found. Uses the active revision of the global component.
# getAreaEditor(string $areaName)
?string
Get the editor for the specified layout area. Returns null if the area with the specified name could not be found. Uses the active revision of the global component.
# getAreaImage(string $areaName)
?Image
Get the image for the component area with the specified name Uses the active revision of the global component.
# getAreaRecord(string $areaName)
?Model
Get the record for the layout area with the specified name. Uses the active revision of the global component.
# getAreaRecords(string $areaName)
?Collection
Get the records for the layout area with the specified name. Uses the active revision of the global component.
# getAreaText(string $areaName)
?string
Get the text for the component area with the specified name Uses the active revision of the global component.
# getAreaValues(string $areaName)
array
Get the values for the component area with the specified name. Uses the active revision of the global component.
# getAreaHtml(string $areaName)
?string
Get the html for the component area with the specified name Uses the active revision of the global component.
# getAreaDate(string $areaName)
?DateTime
Get a date for the layout area with the specified name Uses the active revision of the global component.
# getAreaWidget(string $areaName)
?Widget
Get the widget for the component area with the specified name Uses the active revision of the global component.
# getAreaComponent(string $areaName)
?Component
Get the component for the layout area with the specified name. Uses the active revision of the global component.
# getAreaCollectionElements(string $areaName)
?Collection
Get the component collection elements for the layout area with the specified name. Uses the active revision of the global component.
# getAreaContent(string $areaName)
?Content
Get the content of the component area Uses the active revision of the global component.
# getAreaDefaultContent(string $areaName)
?Content
Get the default content of the component area Uses the active revision of the global component.
# getAreaContentOrDefault(string $areaName)
?Content
Get the content of the component area, or the default content if no content exists Uses the active revision of the global component.
# isAreaBlank(string $areaName)
bool
Check whether the component area with the specified name has no usable content. Uses the active revision of the global component. Blank describes what is stored, not what renders: the answer comes from the stored content and never renders a template. An area can therefore be not blank and still render nothing — a record that was deleted or has no layout, a component or widget whose template outputs nothing, or text whose only content is a placeholder for a deleted image. To decide on the rendered output instead, test the result of getAreaHtml().
# getAreaAttributesContent(string $areaName)
array
Gets the content of every layout area attribute. If layout area does not have attributes, returns empty array. Uses the active revision of the global component.
# getAreaAttributesDefaultContent(string $areaName)
array
Gets the default content of every layout area attribute. If layout area does not have attributes, returns empty array. Uses the active revision of the global component.
# getAreaAttributesContentOrDefault(string $areaName)
array
Gets the content (or the default content if no content exists) of every layout area attribute. If layout area does not have attributes, returns empty array. Uses the active revision of the global component.
# getEntityAreaByLayoutArea(LayoutArea $area)
?Model
Get the link record between the layout area and content for the designated layout area. Uses the active revision of the global component.
# getBranchRevisions(RevisionBranch $branch, ?int $limit, ?int $offset)
Collection
Get the revisions for the provided branch, ordered by id ascending. Pass a limit/offset to fetch a bounded window instead of the full set — loading all revisions of a large branch exhausts memory.
# getNumBranchRevisions(RevisionBranch $branch)
int
Get the number of revisions for the provided branch (COUNT query — does not hydrate)
# getRevisionsWithoutBranch(?int $limit, ?int $offset)
Collection
Get the revisions without branch, ordered by id ascending. Pass a limit/offset to fetch a bounded window instead of the full set — loading all revisions of a record with a large history exhausts memory.
# getRevisionById(int $id)
?GlobalComponentRevision
Get the revision with the specified id
# getComponentAreaByLayoutArea(LayoutArea $area) Admin only
?GlobalComponentRevisionArea
Get the link record between the layout area and content for the designated layout area. Uses the active revision to get the result
# getAvailableSaveActions(?Model $currentRevision) Admin only
array
Get the save actions available for the record and provided revision being edited
# getRevisionActions(Revision $revision, ?Revision $currentRevision) Admin only
array
Get the actions available for the provided revision
# getUpdateRevisionId(Revision $revision) Admin only
?int
Get the revision ID to use when updating the record. If the provided revision is a draft, the previous id is returned, if one exists.