ModelBlogs module

Post

A model in the Blogs module, with 72 members for templates, 39 API properties and 69 members for admin templates.

Blogs\Models\Frontend\Post Blogs\Models\Api\Post Blogs\Models\Backend\Post Also in Blogs: Blog BlogArea Comment PostArea PostRevision
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 49

Take no arguments.

# __toString() Templates only
string
Returns the rendered HTML when the model is used in a string context.
# getName()
?string
Get the name for the active revision
# getText()
?string
Get the text for the active revision
# getFullPath()
string
Gets the full path to the post, including the module and blog routes and starting with a leading slash
# getOriginalFullPath()
string
Get the original path to the post without any custom urls applied.
# getAuthor()
?Author
Fetches first author from the authors list
# getCommentsCount()
int
Returns the total count of comments assigned to the post.
# getTotalCommentsCount()
int
Returns the number of comments assigned to the post.
# getPublishedCommentsCount()
int
Returns the number of comments assigned to the post.
# 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
# getOriginalPath()
string
It's an alias and deprecated! Directly use getOriginalFullPath() instead.
# getOriginalFullSlug()
string
Gets the record's own canonical slug, built from the record's data and _ignoring_ any custom URL override. Like getFullSlug() it excludes the module path, has no leading slash, and includes ancestor slugs for hierarchical records — but it always reflects the record's real slugs rather than a custom URL. For a non-hierarchical record this equals the record's own getSlug() value. This default concatenates whatever the ancestor walk supplies and does not judge the segments: an ancestor with no slug of its own contributes an empty segment rather than failing. A model whose callers need to tell an unresolvable chain apart from a valid one should either return an empty string from an override, as Products\Models\ProductDescription does, or expose a separate check alongside it, as Pages\Models\BasePage::hasResolvableSlugChain() does.
# getFullSlug()
string
Gets the slug that addresses this record relative to its module — the portion of the URL that identifies the record itself, without the module path and without a leading slash. For a hierarchical record the slug includes the slugs of all of its ancestors joined with slashes. This is the effective slug: when a custom URL is set on the record, it _takes precedence and is returned_ here. The no-leading-slash shape describes the canonical value only. A custom URL is returned verbatim, and custom URLs are stored with a leading slash, so a record that has one returns /my-custom rather than my-custom; use getOriginalFullSlug() when you need the canonical shape unconditionally.
# getId()
?int
# getSite()
?Site
# getSlug()
?string
# getLockComments()
bool
# isFeatured()
?bool
# getCreated()
?DateTime
Get the date the record was created.
# getModified()
?DateTime
Get the last modification date for the record.
# getPublished()
?DateTime
Get the date the record was published or is scheduled to be published.
# isPublished()
bool
Check if the record is published.
# getAuthors()
?Collection<Author>
# getBlog()
?Blog
# getTags()
?Collection<Tag>
# getCategories()
?Collection<Category>
# getComments()
?Collection<Comment>
# getActiveRevision()
?PostRevision
# getRevisions()
?Collection<PostRevision>
# getLastRevision()
?PostRevision
Get the last revision for the entity. If a revision has been added, this will be the newly added revision.
# getSeoSettings()
?SeoSettings
# getLanguage()
?Language
# getSourcePost()
?Post
# getRelatedPosts()
?Collection<Post>
# getOwner()
?User
# getCustomUrl()
?CustomUrl
Get the custom url used for the page. This will take precedence over the slugs of this page, parent page and the module.
# getExternalId()
?string
# 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
# getPublishedComments() Templates only
Collection
Find published comments for this post
# getUrl() Templates only
string
Get the url for a specific post
# getOtherLanguageVersions() Templates only
array
Fetch an associative array with other language versions of this post The key of the array is the language code id (e.g. "en-us") and the value is the post.
# getPrevious() Templates only
?Post
Gets previous post for a current one
# getNext() Templates only
?Post
Gets next post for a current one
# getHtml() Templates only
string
Gets the rendered HTML for the record using its layout template.

Methods 23

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

# 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)
?PostRevision
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
# getAreaType(string $areaName) Templates only
?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) Templates only
?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) Templates only
?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) Templates only
?Image
Get the image for the layout area with the specified name, using 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
# getAreaRecord(string $areaName) Templates only
?Model
Get the record for the layout area with the specified name, using the active revision of the record
# getAreaRecords(string $areaName) Templates only
?Collection
Get the records for the layout area with the specified name, using the active revision of the record
# getAreaText(string $areaName) Templates only
?string
Get the text for the layout area with the specified name, using the active revision of the record
# getAreaValues(string $areaName) Templates only
array
Get the values for the layout area with the specified name, using the active revision of the record
# getAreaDate(string $areaName) Templates only
?DateTime
Get a date for the layout area with the specified name, using the active revision of the record
# getAreaWidget(string $areaName) Templates only
?Widget
Get the widget for the layout area with the specified name, using the active revision of the record
# getAreaComponent(string $areaName) Templates only
?Component
Get the component for the layout area with the specified name, using the active revision of the record
# getAreaCollectionElements(string $areaName) Templates only
?Collection
Get the component collection elements for the layout area with the specified name, using the active revision of the record
# getAreaHtml(string $areaName) Templates only
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.
# getAreaDefaultContent(string $areaName) Templates only
?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) Templates only
?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) Templates only
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().

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 39

Read-only values on the record.

# name
?string
Get the name for the active revision
# text
?string
Get the text for the active revision
# fullPath
string
Gets the full path to the post, including the module and blog routes and starting with a leading slash
# originalFullPath
string
Get the original path to the post without any custom urls applied.
# author
?Author
Fetches first author from the authors list
# commentsCount
int
Returns the total count of comments assigned to the post.
# totalCommentsCount
int
Returns the number of comments assigned to the post.
# publishedCommentsCount
int
Returns the number of comments assigned to the post.
# 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
# originalPath
string
It's an alias and deprecated! Directly use getOriginalFullPath() instead.
# originalFullSlug
string
Gets the record's own canonical slug, built from the record's data and _ignoring_ any custom URL override. Like getFullSlug() it excludes the module path, has no leading slash, and includes ancestor slugs for hierarchical records — but it always reflects the record's real slugs rather than a custom URL. For a non-hierarchical record this equals the record's own getSlug() value. This default concatenates whatever the ancestor walk supplies and does not judge the segments: an ancestor with no slug of its own contributes an empty segment rather than failing. A model whose callers need to tell an unresolvable chain apart from a valid one should either return an empty string from an override, as Products\Models\ProductDescription does, or expose a separate check alongside it, as Pages\Models\BasePage::hasResolvableSlugChain() does.
# fullSlug
string
Gets the slug that addresses this record relative to its module — the portion of the URL that identifies the record itself, without the module path and without a leading slash. For a hierarchical record the slug includes the slugs of all of its ancestors joined with slashes. This is the effective slug: when a custom URL is set on the record, it _takes precedence and is returned_ here. The no-leading-slash shape describes the canonical value only. A custom URL is returned verbatim, and custom URLs are stored with a leading slash, so a record that has one returns /my-custom rather than my-custom; use getOriginalFullSlug() when you need the canonical shape unconditionally.
# id
?int
# site
?Site
# slug
?string
# lockComments
bool
# created
?DateTime
Get the date the record was created.
# modified
?DateTime
Get the last modification date for the record.
# published
?DateTime
Get the date the record was published or is scheduled to be published.
# published
bool
Check if the record is published.
# authors
?Collection<Author>
# blog
?Blog
# tags
?Collection<Tag>
# categories
?Collection<Category>
# comments
?Collection<Comment>
# activeRevision
?PostRevision
# revisions
?Collection<PostRevision>
# lastRevision
?PostRevision
Get the last revision for the entity. If a revision has been added, this will be the newly added revision.
# seoSettings
?SeoSettings
# language
?Language
# sourcePost
?Post
# owner
?User
# customUrl
?CustomUrl
Get the custom url used for the page. This will take precedence over the slugs of this page, parent page and the module.
# externalId
?string

Admin view

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

Properties 62

Take no arguments.

# getName()
?string
Get the name for the active revision
# getText()
?string
Get the text for the active revision
# getImageRootTargetFolderPath() Admin only
string
Retrieves the root target folder path for uploaded images. It is the blog's root (not a target) path.
# getImageTargetFolderPath() Admin only
string
Retrieves the target folder path for uploaded images. Images will be moved to this path after the upload has been processed. It is the root target path (taken from blog) for the new records or the path based on the blog image folder (not root) path.
# getFullPath()
string
Gets the full path to the post, including the module and blog routes and starting with a leading slash
# getOriginalFullPath()
string
Get the original path to the post without any custom urls applied.
# getAuthor()
?Author
Fetches first author from the authors list
# getCommentsCount()
int
Returns the total count of comments assigned to the post.
# getTotalCommentsCount()
int
Returns the number of comments assigned to the post.
# getPublishedCommentsCount()
int
Returns the number of comments assigned to the post.
# 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
# getOriginalPath()
string
It's an alias and deprecated! Directly use getOriginalFullPath() instead.
# getOriginalFullSlug()
string
Gets the record's own canonical slug, built from the record's data and _ignoring_ any custom URL override. Like getFullSlug() it excludes the module path, has no leading slash, and includes ancestor slugs for hierarchical records — but it always reflects the record's real slugs rather than a custom URL. For a non-hierarchical record this equals the record's own getSlug() value. This default concatenates whatever the ancestor walk supplies and does not judge the segments: an ancestor with no slug of its own contributes an empty segment rather than failing. A model whose callers need to tell an unresolvable chain apart from a valid one should either return an empty string from an override, as Products\Models\ProductDescription does, or expose a separate check alongside it, as Pages\Models\BasePage::hasResolvableSlugChain() does.
# getFullSlug()
string
Gets the slug that addresses this record relative to its module — the portion of the URL that identifies the record itself, without the module path and without a leading slash. For a hierarchical record the slug includes the slugs of all of its ancestors joined with slashes. This is the effective slug: when a custom URL is set on the record, it _takes precedence and is returned_ here. The no-leading-slash shape describes the canonical value only. A custom URL is returned verbatim, and custom URLs are stored with a leading slash, so a record that has one returns /my-custom rather than my-custom; use getOriginalFullSlug() when you need the canonical shape unconditionally.
# getId()
?int
# getSite()
?Site
# getSlug()
?string
# getLockComments()
bool
# isFeatured()
?bool
# getCreated()
?DateTime
Get the date the record was created.
# getModified()
?DateTime
Get the last modification date for the record.
# getPublished()
?DateTime
Get the date the record was published or is scheduled to be published.
# isPublished()
bool
Check if the record is published.
# getAuthors()
?Collection<Author>
# getBlog()
?Blog
# getTags()
?Collection<Tag>
# getCategories()
?Collection<Category>
# getComments()
?Collection<Comment>
# getActiveRevision()
?PostRevision
# getRevisions()
?Collection<PostRevision>
# getLastRevision()
?PostRevision
Get the last revision for the entity. If a revision has been added, this will be the newly added revision.
# getSeoSettings()
?SeoSettings
# getLanguage()
?Language
# getSourcePost()
?Post
# getRelatedPosts()
?Collection<Post>
# getOwner()
?User
# getCustomUrl()
?CustomUrl
Get the custom url used for the page. This will take precedence over the slugs of this page, parent page and the module.
# getExternalId()
?string
# 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
# getAvailableUsers() Admin only
Collection
Get the available users
# getAvailableLayouts() Admin only
Collection
Get the available layouts
# getAvailableSourcePosts() Admin only
Collection
Get the available source posts for this posts
# getCreateChildUrl() Admin only
?string
Get the url for creating a child record.
# getDisplayProperty() Admin only
string
Get the display property to use
# getGroupByProperty() Admin only
string
Get the property by which this record should be grouped by (for select fields)
# getSortByProperty() Admin only
string
Get the property by which this record should be sorted by
# getEditUrl() Admin only
?string
Get the url for editing the record.
# getDeleteUrl() Admin only
?string
Get the url for deleting the record.
# getPermissionsUrl() Admin only
?string
Get the url for editing the permissions of the record.
# getCheckPermissionsUrl() Admin only
?string
Get the url for checking user permissions for this record.
# getPublishUrl() Admin only
?string
Get the url for publishing the record.
# getManageUrl() Admin only
?string
Get the url for managing records.
# getShowFrontendUrl() Admin only
?string
Get the url showing the record in the frontend
# getDuplicateUrl() Admin only
?string
Get the url for duplicating the record.
# 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.

Methods 7

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

# 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)
?PostRevision
Get the revision with the specified id
# 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.