ModelCommon module

Content

A model in the Common module, with 24 members for templates, 19 API properties and 26 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 24

Take no arguments.

# __toString() Templates only
string
Handle string representation for response model
# getIframeSrcText()
string
Get the escaped source of the text for the use within an iframe src tag
# isBlank()
bool
Return the information that this is not blank content
# getText()
?string
Get the text for this content. Also parses image and link placeholders in the process.
# getDate()
?DateTime
Get the date from the content
# getRecordModel()
?Model
Retrieve the model associated with the content for content with the 'record' category
# getRecordModels()
?Collection
Retrieve the models associated with the content for content with the 'records' category
# getId()
?int
# getCreated()
?DateTime
# getModified()
?DateTime
# getComponent()
Component
Get the component for the content. In the frontend, this method will also return a global component. Returns a BlankComponent if no component was set.
# getGlobalComponent()
?GlobalComponent
# getImage()
Image
Get the image for the content Will return a BlankImage if no image was set
# getFile()
?File
# getType()
?InputType
# getWidget()
Widget
Get the widget for the content Will return a BlankWidget if no widget was set
# getCollection()
?Collection<ollectionElement>
# getContainer()
?Model
# getValues()
array
Gets values of the content in array representation. Should be used for "multiselect" input type. Otherwise, it will always be an empty array.
# isEmpty()
bool
Checks if the content is empty. Also considers blank images, widgets or components in the frontend.
# 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
# getHtml() Templates only
string
Get the HTML for this content

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 19

Read-only values on the record.

# iframeSrcText
string
Get the escaped source of the text for the use within an iframe src tag
# blank
bool
Return the information that this is not blank content
# text
?string
Get the text for this content. Also parses image and link placeholders in the process.
# date
?DateTime
Get the date from the content
# recordModel
?Model
Retrieve the model associated with the content for content with the 'record' category
# recordModels
?Collection
Retrieve the models associated with the content for content with the 'records' category
# id
?int
# created
?DateTime
# modified
?DateTime
# component
?Component
# globalComponent
?GlobalComponent
# image
?Image
# file
?File
# type
?InputType
# widget
?Widget
# collection
?Collection<ollectionElement>
# container
?Model
# values
array
Gets values of the content in array representation. Should be used for "multiselect" input type. Otherwise, it will always be an empty array.
# empty
bool
Checks if the content is empty

Admin view

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

Properties 26

Take no arguments.

# getValuesList() Admin only
array
Gets values array that is suitable to be used in <select> tag.
In this case every key equals to its value.
# getPlaceholder() Admin only
string
Gets placeholder for this content based on its value.
Usually returns encoded value of a content text.
If content is a multiselect, returns all its values separated by comma.
Returned value is encoded and can be used in HTML attributes (usually in "placeholder").
# getIframeSrcText()
string
Get the escaped source of the text for the use within an iframe src tag
# isBlank()
bool
Return the information that this is not blank content
# getText()
?string
Get the text for this content. Also parses image and link placeholders in the process.
# getDate()
?DateTime
Get the date from the content
# getRecordModel()
?Model
Retrieve the model associated with the content for content with the 'record' category
# getRecordModels()
?Collection
Retrieve the models associated with the content for content with the 'records' category
# getId()
?int
# getCreated()
?DateTime
# getModified()
?DateTime
# getComponent()
?Component
# getGlobalComponent()
?GlobalComponent
# getImage()
?Image
# getFile()
?File
# getType()
?InputType
# getWidget()
?Widget
# getCollection()
?Collection<ollectionElement>
# getContainer()
?Model
# getValues()
array
Gets values of the content in array representation. Should be used for "multiselect" input type. Otherwise, it will always be an empty array.
# isEmpty()
bool
Checks if the content is empty
# 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
# getRecordId() Admin only
?int
Get the record id for the content
# getRecordIds() Admin only
array
Get the record ids for the content