ModelBlogs module

Blog

A model in the Blogs module, with 82 members for templates, 43 API properties and 91 members for admin templates.

Blogs\Models\Frontend\Blog Blogs\Models\Api\Blog Blogs\Models\Backend\Blog Also in Blogs: BlogArea Comment Post 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.
# getText()
?string
Get the description for this blog. Also parses image and link placeholders in the process.
# getOriginalFullPath()
string
Gets the blog's own canonical path within the site, _ignoring_ any custom URL override
# getAreas()
?Collection
# getAreaGroups()
?Collection
Gets the layout area groups
# getPostsCount()
int
Returns the total count of posts assigned to the blog.
# getCommentsCount()
int
Returns the total count of comments across all posts of the blog.
# getTotalPostsCount()
int
Returns the number of posts assigned to the blog.
# getPublishedPostsCount()
int
Returns the number of posts assigned to the blog.
# getTotalCommentsCount()
int
Returns the number of comments across all posts of the blog.
# getPublishedCommentsCount()
int
Returns the number of comments across all posts of the blog.
# 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.
# getFullPath()
string
Gets the relative path that addresses this record within the site, including the module path and starting with a leading slash. This is the getFullSlug() value prefixed with the route under which the module is mounted. This is the effective path: when a custom URL is set on the record, it _takes precedence and is returned_ here. Returns an empty string when the record has no custom URL and getOriginalFullPath() cannot build one, so callers must treat an empty string as "no url" rather than as a path. Rendering it into markup or handing it to a cache or route helper would otherwise point the record at whatever the site serves at its root.
# getId()
?int
# getName()
?string
# getSlug()
?string
# 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.
# getAuthor()
?Author
# getSite()
?Site
# getImage()
?Image
# getLayout()
?Layout
# getPostsLayout()
?Layout
# getAllowRss()
bool
# getLockComments()
bool
# getAutoPublishPosts()
bool
# getAutoPublishComments()
bool
# getRequireCommentatorEmail()
bool
# getTags()
?Collection<Tag>
# getCategories()
?Collection<Category>
# getPosts()
?Collection<Post>
# getSeoSettings()
?SeoSettings
# getLanguage()
?Language
# getSourceBlog()
?Blog
# getRelatedBlogs()
?Collection<Blog>
# getOwner()
?User
# getBlogAreas()
?Collection<BlogArea>
# 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
# getUrl() Templates only
string
Get the url for this blog
# getOtherLanguageVersions() Templates only
array
Fetch an associative array with other language versions of this blog The key of the array is the language code id (e.g. "en-us") and the value is the blog.
# getHtml() Templates only
string
Gets the rendered HTML for the record using its layout template.

Methods 33

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

# getPostsByCategoryNames(array $names)
Collection
Gets all posts of the current blog by given category names. It uses 'OR' condition for every passed value.
# getPostsByCategorySlugs(array $slugs)
Collection
Gets all posts of the current blog by given category slugs. It uses 'OR' condition for every passed value.
# getPostsByTagNames(array $names)
Collection
Gets all posts of the current blog by given tag names. It uses 'OR' condition for every passed value.
# getPostsByTagSlugs(array $slugs)
Collection
Gets all posts of the current blog by given tag slugs. It uses 'OR' condition for every passed value.
# getPostsByAuthorNames(array $names)
Collection
Gets all posts of the current blog by given author display names. It uses 'OR' condition for every passed value.
# getPostsByAuthorSlugs(array $slugs)
Collection
Gets all posts of the current blog by given author slugs. It uses 'OR' condition for every passed value, and matches a post when any of its credited authors qualifies. Prefer this over filtering a fetched collection in a template: ModelsCollection::filtered() cannot express an author query, and silently narrows to the first credited author instead. Passing an empty array is a caller error and throws. A list holding only authors that have no slug yet returns an empty collection.
# getAreaContent(string $areaName)
Content
Get the content of the layout area Will return a BlankContent if no content was defined
# getAreaDefaultContent(string $areaName)
Content
Get the default content of the layout area 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 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. Resolves the area's content, falling back to its default, and reports the area as blank when no content exists at all, when the content is one of the framework's Blank objects, or when the content is empty for its category. 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(). Emptiness cannot always be determined — Content::isEmpty() throws a RuntimeException when the content has no input type, or when its category is not one the framework knows how to answer for. Those two cases are reported as not blank, the same answer the Twig empty test gives. Any other failure, such as a database error, is not contained and reaches the error handler.
# getAreaAttributesContent(string $areaName)
array
Gets the content of every layout area attribute. If layout area does not have attributes, returns empty array.
# getAreaAttributesDefaultContent(string $areaName)
array
Gets the default content of every layout area attribute. If layout area does not have attributes, returns empty array.
# 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.
# getEntityAreaByLayoutArea(LayoutArea $area)
?Model
Get the link record between the layout area and content for the designated layout area
# hasAreaWithName(string $areaName)
bool
Check if an area with the specified name exists for the container
# 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.
# 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.
# 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.
# getAreaImage(string $areaName)
Image
Get the image for the layout area with the specified name Will return a BlankImage if no image was defined
# getAreaFile(string $areaName)
?File
Get the file for the layout area with the specified name
# getAreaRecord(string $areaName)
?Model
Get the record for the layout area with the specified name
# getAreaRecords(string $areaName)
?Collection
Get the records for the layout area with the specified name
# getAreaText(string $areaName)
?string
Get the text for the layout area with the specified name
# getAreaValues(string $areaName)
array
Get the values for the layout area with the specified name
# getAreaDate(string $areaName)
?DateTime
Get a date for the layout area with the specified name
# getAreaWidget(string $areaName)
Widget
Get the widget for the layout area with the specified name Will return a BlankWidget if no image was defined
# getAreaComponent(string $areaName)
Component
Get the component for the layout area with the specified name Will return a BlankComponent if no image was defined
# getAreaCollectionElements(string $areaName)
?Collection
Get the component collection elements for the layout area with the specified name
# getAreaHtml(string $areaName)
string
Get the rendered HTML for the component area with the specified name. Adds live preview tags, if enabled.
# getAuthorPostsUrl(Author $author) Templates only
string
Get the url for all posts by an author
# getTagPostsUrl(Tag $tag) Templates only
string
Get the url for all posts in a category
# getCategoryPostsUrl(Category $category) Templates only
string
Get the url for all posts in a category
# getAreaImageOrPlaceholder(string $areaName, int $width, int $height) Templates only
Image
Get the image for the component area with the specified name 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)

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 43

Read-only values on the record.

# text
?string
Get the description for this blog. Also parses image and link placeholders in the process.
# originalFullPath
string
Gets the blog's own canonical path within the site, _ignoring_ any custom URL override
# areas
?Collection
# areaGroups
?Collection
Gets the layout area groups
# postsCount
int
Returns the total count of posts assigned to the blog.
# commentsCount
int
Returns the total count of comments across all posts of the blog.
# totalPostsCount
int
Returns the number of posts assigned to the blog.
# publishedPostsCount
int
Returns the number of posts assigned to the blog.
# totalCommentsCount
int
Returns the number of comments across all posts of the blog.
# publishedCommentsCount
int
Returns the number of comments across all posts of the blog.
# 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.
# fullPath
string
Gets the relative path that addresses this record within the site, including the module path and starting with a leading slash. This is the getFullSlug() value prefixed with the route under which the module is mounted. This is the effective path: when a custom URL is set on the record, it _takes precedence and is returned_ here. Returns an empty string when the record has no custom URL and getOriginalFullPath() cannot build one, so callers must treat an empty string as "no url" rather than as a path. Rendering it into markup or handing it to a cache or route helper would otherwise point the record at whatever the site serves at its root.
# id
?int
# name
?string
# slug
?string
# 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.
# author
?Author
# site
?Site
# image
?Image
# layout
?Layout
# postsLayout
?Layout
# allowRss
bool
# lockComments
bool
# autoPublishPosts
bool
# autoPublishComments
bool
# requireCommentatorEmail
bool
# tags
?Collection<Tag>
# categories
?Collection<Category>
# posts
?Collection<Post>
# seoSettings
?SeoSettings
# language
?Language
# sourceBlog
?Blog
# relatedBlogs
?Collection<Blog>
# owner
?User
# blogAreas
?Collection<BlogArea>
# 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
# areasContent API & Jobs only
AreasContent
Fetch content for all layout areas defined for the model as AreasContent object

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.

# getText()
?string
Get the description for this blog. Also parses image and link placeholders in the process.
# getImageRootTargetFolderPath() Admin only
string
Retrieves the root target folder path for uploaded images.
# getOriginalFullPath()
string
Gets the blog's own canonical path within the site, _ignoring_ any custom URL override
# getAreas()
?Collection
# getAreaGroups()
?Collection
Gets the layout area groups
# getPostsCount()
int
Returns the total count of posts assigned to the blog.
# getCommentsCount()
int
Returns the total count of comments across all posts of the blog.
# getTotalPostsCount()
int
Returns the number of posts assigned to the blog.
# getPublishedPostsCount()
int
Returns the number of posts assigned to the blog.
# getTotalCommentsCount()
int
Returns the number of comments across all posts of the blog.
# getPublishedCommentsCount()
int
Returns the number of comments across all posts of the blog.
# 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.
# 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.
# getFullPath()
string
Gets the relative path that addresses this record within the site, including the module path and starting with a leading slash. This is the getFullSlug() value prefixed with the route under which the module is mounted. This is the effective path: when a custom URL is set on the record, it _takes precedence and is returned_ here. Returns an empty string when the record has no custom URL and getOriginalFullPath() cannot build one, so callers must treat an empty string as "no url" rather than as a path. Rendering it into markup or handing it to a cache or route helper would otherwise point the record at whatever the site serves at its root.
# getId()
?int
# getName()
?string
# getSlug()
?string
# 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.
# getAuthor()
?Author
# getSite()
?Site
# getImage()
?Image
# getLayout()
?Layout
# getPostsLayout()
?Layout
# getAllowRss()
bool
# getLockComments()
bool
# getAutoPublishPosts()
bool
# getAutoPublishComments()
bool
# getRequireCommentatorEmail()
bool
# getTags()
?Collection<Tag>
# getCategories()
?Collection<Category>
# getPosts()
?Collection<Post>
# getSeoSettings()
?SeoSettings
# getLanguage()
?Language
# getSourceBlog()
?Blog
# getRelatedBlogs()
?Collection<Blog>
# getOwner()
?User
# getBlogAreas()
?Collection<BlogArea>
# 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
# getRootCategories() Admin only
Collection
Get the root categories
# getAvailableUsers() Admin only
Collection
Get the available users
# getAvailableLayouts() Admin only
Collection
Get the available blog layouts
# getAvailablePostLayouts() Admin only
Collection
Get the available post layouts
# getAvailableSourceBlogs() Admin only
Collection
Get the available source blogs for this blog
# getCreateChildUrl() Admin only
?string
Get the url for creating a child record.
# getDisplayProperty() Admin only
string
Get the display property to use
# 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

Methods 29

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

# getPostsByCategoryNames(array $names)
Collection
Gets all posts of the current blog by given category names. It uses 'OR' condition for every passed value.
# getPostsByCategorySlugs(array $slugs)
Collection
Gets all posts of the current blog by given category slugs. It uses 'OR' condition for every passed value.
# getPostsByTagNames(array $names)
Collection
Gets all posts of the current blog by given tag names. It uses 'OR' condition for every passed value.
# getPostsByTagSlugs(array $slugs)
Collection
Gets all posts of the current blog by given tag slugs. It uses 'OR' condition for every passed value.
# getPostsByAuthorNames(array $names)
Collection
Gets all posts of the current blog by given author display names. It uses 'OR' condition for every passed value.
# getPostsByAuthorSlugs(array $slugs)
Collection
Gets all posts of the current blog by given author slugs. It uses 'OR' condition for every passed value, and matches a post when any of its credited authors qualifies. Prefer this over filtering a fetched collection in a template: ModelsCollection::filtered() cannot express an author query, and silently narrows to the first credited author instead. Passing an empty array is a caller error and throws. A list holding only authors that have no slug yet returns an empty collection.
# getAreaContent(string $areaName)
?Content
Get the content of the layout area
# getAreaDefaultContent(string $areaName)
?Content
Get the default content of the layout area
# getAreaContentOrDefault(string $areaName)
?Content
Get the content of the layout area, or the default content if no content exists
# isAreaBlank(string $areaName)
bool
Check whether the layout area with the specified name has no usable content. Resolves the area's content, falling back to its default, and reports the area as blank when no content exists at all, when the content is one of the framework's Blank objects, or when the content is empty for its category. 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(). Emptiness cannot always be determined — Content::isEmpty() throws a RuntimeException when the content has no input type, or when its category is not one the framework knows how to answer for. Those two cases are reported as not blank, the same answer the Twig empty test gives. Any other failure, such as a database error, is not contained and reaches the error handler.
# getAreaAttributesContent(string $areaName)
array
Gets the content of every layout area attribute. If layout area does not have attributes, returns empty array.
# getAreaAttributesDefaultContent(string $areaName)
array
Gets the default content of every layout area attribute. If layout area does not have attributes, returns empty array.
# 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.
# getEntityAreaByLayoutArea(LayoutArea $area)
?Model
Get the link record between the layout area and content for the designated layout area
# hasAreaWithName(string $areaName)
bool
Check if an area with the specified name exists for the container
# 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.
# 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.
# 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.
# getAreaImage(string $areaName)
?Image
Get the image for the layout area with the specified name
# getAreaFile(string $areaName)
?File
Get the file for the layout area with the specified name
# getAreaRecord(string $areaName)
?Model
Get the record for the layout area with the specified name
# getAreaRecords(string $areaName)
?Collection
Get the records for the layout area with the specified name
# getAreaText(string $areaName)
?string
Get the text for the layout area with the specified name
# getAreaValues(string $areaName)
array
Get the values for the layout area with the specified name
# getAreaDate(string $areaName)
?DateTime
Get a date for the layout area with the specified name
# getAreaWidget(string $areaName)
?Widget
Get the widget for the layout area with the specified name
# getAreaComponent(string $areaName)
?Component
Get the component for the layout area with the specified name
# getAreaCollectionElements(string $areaName)
?Collection
Get the component collection elements for the layout area with the specified name
# getAreaHtml(string $areaName)
string
Get the rendered HTML for the component area with the specified name. Adds live preview tags, if enabled.