This object represents an element in catalogue elements list. Read more about using Element catalogs.
Every element page has this property accessible from element
property. Every page with elements type template has property elements
containing array of element objects bound to the page. Elements list can be obtained also by using {% elementscontext %}
tag from all pages. See more from elements listing template example and element page template example.
Id of element definition model. See also model_name.
Returns true if element is not yet saved to server. Useful if content areas will additionally be bound to element. If element is new this binding should not be done as the element to bind it to does not exist.
{% unless element.new_record? %}
{% content name="element_gallery" bind="Element" %}
{% endunless %}
Returns the page object of elements page where current element is located.
Returns related page object ID.
Returns title of element. Property can be made user editable in template.
In element object template the title has to be present and editable, as otherwise object can not be saved.
{% editable element.title %}
Returns name of element model.
{% if element.model_name == "People" %}
Returns URL for given element (e.g. "/people/jon").
Returns path (slug) of the element (e.g. "jon").
Returns full path of the element without leading slash (e.g. "people/jon").
Order of the element in context of the parent page.
Element creation time.
Last update time.
All user defined properties of element definition are accessible directly as element properties.
If user has defined a property with code description
, editable tag for this in elements template would be:
{% editable element.description %}
Editable tag generates the editable field depending of the property type. If property type is image, the image drop area is generated. Currently the image drop area supports only one size of the image. By default drop area saves original image. User can set target_width
parameter to specify the expected size of the saved image. For example if image property should be rendered into 800px wide container:{% editable element.image target_width="800" %}
In that case the image drop area saves the image which width is closest to the target width instead of original.{{ element.model_fields }}
collection. Each property description in this collection also contains property name, data type, key name, available options and of course, its value.{% for field in element.model_fields %}
{{ field.title }}: {{ field }}<br/>
{% endfor %}
Each item in model_fields collection has following properties:{{ field }}
directly also outputs the field's value.