ModelProducts module

Category

A model in the Products module, with 40 members for templates, 26 API properties and 49 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 30

Take no arguments.

# __toString() Templates only
string
Returns the rendered HTML when the model is used in a string context.
# getName()
?string
Fetches the name in the default description for this container
# getSlug()
?string
Fetches the slug for the default description for this container
# getFullSlug()
string
Gets the effective full slug for the container by forwarding to its default description. All four UrlAddressable methods forward instead of using the urlAddressableModel defaults, because a container's URL is entirely its default description's URL: the custom URL lives on the description entity, not on the container entity, so the trait's resolveCustomUrl() would check the container's own entity — which has no getCustomUrl() — and silently drop the description's custom URL. The description itself uses urlAddressableModel, so the guarded custom-URL resolution still happens exactly once, one level down. That is why this trait does not use urlAddressableModel: every method it would contribute is replaced here.
# getFullPath()
string
Gets the effective full path for the container by forwarding to its default description
# getOriginalFullSlug()
string
Gets the original full slug for the container by forwarding to its default description
# getOriginalFullPath()
string
Gets the original path for the container without any custom urls applied by forwarding to its default description
# hasDefaultDescription()
bool
Checks if the container has a default description.
# getDefaultDescription()
Model
Fetches the description in the default language for this container.
# getOriginalPath()
string
It's an alias and deprecated! Directly use getOriginalFullPath() instead.
# getId()
?int
# getPosition()
?int
# getCreated()
?DateTime
Date the record was created.
# getModified()
?DateTime
Last modification date for the record.
# getPublished()
?DateTime
# getParent()
?Category
# getChildren()
?Collection<Category>
# getSite()
?Site
# isPublished()
bool
Determines if the record is published.
# getCategoryElements()
?Collection<CategoryElement>
# getProducts()
Collection
Gets products associated with current category
# getDescriptions()
?Collection<CategoryDescription>
# getFullPosition()
string
Get the full, dot-separated full position for hierarchical records
# getCustomFieldValues()
?Collection<CategoryCustomFieldValue>
# getCustomFields()
array
Get the custom fields for this entity
# 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
# getHtml() Templates only
string
Gets the rendered HTML for the record using its layout template. Delegates to the default description, which holds the layout.

Methods 10

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

# getDescriptionForLanguage(Language $language)
?Model
Retrieves the description for the specified language. Returns null when there is no description in that language.
# getCustomFieldValue(CustomField $customField)
?CustomFieldValue
Get the value for a custom field
# getCustomFieldValueByName(string $customFieldName)
?CustomFieldValue
Get the value for a custom field by the custom field name
# getCustomFieldContent(string $customFieldName)
?Content
Get the content for the custom field identified by the specified name
# getCustomFieldContentOrDefault(string $customFieldName)
?Content
Get the (default) content for the custom field identified by the specified name
# getCustomFieldBoolean(string $customFieldName, ?bool $default)
?bool
Get the (default) content of the custom field as boolean value
# getCustomFieldText(string $customFieldName, ?string $default)
?string
Get the (default) content of the custom field as text
# getCustomFieldImage(string $customFieldName)
?Image
Get the (default) image contained in the custom field
# getCustomFieldFile(string $customFieldName)
?File
Get the (default) file contained in the custom field
# hasCustomField(string $customFieldName)
bool
Check if the entity has a custom field with the specified name

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.

# name
?string
Fetches the name in the default description for this container
# slug
?string
Fetches the slug for the default description for this container
# fullSlug
string
Gets the effective full slug for the container by forwarding to its default description. All four UrlAddressable methods forward instead of using the urlAddressableModel defaults, because a container's URL is entirely its default description's URL: the custom URL lives on the description entity, not on the container entity, so the trait's resolveCustomUrl() would check the container's own entity — which has no getCustomUrl() — and silently drop the description's custom URL. The description itself uses urlAddressableModel, so the guarded custom-URL resolution still happens exactly once, one level down. That is why this trait does not use urlAddressableModel: every method it would contribute is replaced here.
# fullPath
string
Gets the effective full path for the container by forwarding to its default description
# originalFullSlug
string
Gets the original full slug for the container by forwarding to its default description
# originalFullPath
string
Gets the original path for the container without any custom urls applied by forwarding to its default description
# defaultDescription
bool
Checks if the container has a default description.
# defaultDescription
Model
Fetches the description in the default language for this container.
# originalPath
string
It's an alias and deprecated! Directly use getOriginalFullPath() instead.
# id
?int
# position
?int
# created
?DateTime
Date the record was created.
# modified
?DateTime
Last modification date for the record.
# published
?DateTime
# parent
?Category
# children
?Collection<Category>
# site
?Site
# published
bool
Determines if the record is published.
# categoryElements
?Collection<CategoryElement>
# products
Collection
Gets products associated with current category
# fullPosition
string
Get the full, dot-separated full position for hierarchical records
# customFieldValues
?Collection<CategoryCustomFieldValue>
# customFieldContent
object
Get a serialized representation of the custom fields associated with the record
# customFields
array
Get the custom fields for this entity
# 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 39

Take no arguments.

# getName()
?string
Fetches the name in the default description for this container
# getSlug()
?string
Fetches the slug for the default description for this container
# getFullSlug()
string
Gets the effective full slug for the container by forwarding to its default description. All four UrlAddressable methods forward instead of using the urlAddressableModel defaults, because a container's URL is entirely its default description's URL: the custom URL lives on the description entity, not on the container entity, so the trait's resolveCustomUrl() would check the container's own entity — which has no getCustomUrl() — and silently drop the description's custom URL. The description itself uses urlAddressableModel, so the guarded custom-URL resolution still happens exactly once, one level down. That is why this trait does not use urlAddressableModel: every method it would contribute is replaced here.
# getFullPath()
string
Gets the effective full path for the container by forwarding to its default description
# getOriginalFullSlug()
string
Gets the original full slug for the container by forwarding to its default description
# getOriginalFullPath()
string
Gets the original path for the container without any custom urls applied by forwarding to its default description
# hasDefaultDescription()
bool
Checks if the container has a default description.
# getDefaultDescription()
Model
Fetches the description in the default language for this container.
# getOriginalPath()
string
It's an alias and deprecated! Directly use getOriginalFullPath() instead.
# getId()
?int
# getPosition()
?int
# getCreated()
?DateTime
Date the record was created.
# getModified()
?DateTime
Last modification date for the record.
# getPublished()
?DateTime
# getParent()
?Category
# getChildren()
?Collection<Category>
# getSite()
?Site
# isPublished()
bool
Determines if the record is published.
# getCategoryElements()
?Collection<CategoryElement>
# getProducts()
Collection
Gets products associated with current category
# getDescriptions()
?Collection<CategoryDescription>
# getFullPosition()
string
Get the full, dot-separated full position for hierarchical records
# getCustomFieldValues()
?Collection<CategoryCustomFieldValue>
# getCustomFields()
array
Get the custom fields for this entity
# 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
# getDeleteUrl() Admin only
?string
Get delete URL for the category
# getCreateChildUrl() Admin only
?string
Get the url for creating a child record.
# getEditUrl() Admin only
?string
Get the url for editing the record.
# getMoveUrl() Admin only
?string
Get the url for moving 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.
# getDuplicateUrl() Admin only
?string
Get the url for duplicating the record.
# getDefaultLanguage() Admin only
Language
Gets the default language for the record.
# getSupportedLanguages() Admin only
Collection
Gets the supported languages.

Methods 10

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

# getDescriptionForLanguage(Language $language)
?Model
Retrieves the description for the specified language. Returns null when there is no description in that language.
# getCustomFieldValue(CustomField $customField)
?CustomFieldValue
Get the value for a custom field
# getCustomFieldValueByName(string $customFieldName)
?CustomFieldValue
Get the value for a custom field by the custom field name
# getCustomFieldContent(string $customFieldName)
?Content
Get the content for the custom field identified by the specified name
# getCustomFieldContentOrDefault(string $customFieldName)
?Content
Get the (default) content for the custom field identified by the specified name
# getCustomFieldBoolean(string $customFieldName, ?bool $default)
?bool
Get the (default) content of the custom field as boolean value
# getCustomFieldText(string $customFieldName, ?string $default)
?string
Get the (default) content of the custom field as text
# getCustomFieldImage(string $customFieldName)
?Image
Get the (default) image contained in the custom field
# getCustomFieldFile(string $customFieldName)
?File
Get the (default) file contained in the custom field
# hasCustomField(string $customFieldName)
bool
Check if the entity has a custom field with the specified name