Content model overview¶
The content structure in Ibexa DXP is based on Content items. A Content item represents a single piece of content: an article, a blog post, an image, a product, etc. Each Content item is an instance of a Content Type.
An introduction to the content model for non-developer users is available in Ibexa DXP user documentation.
A Content item consists of:
- Content information
- Fields, defined by the Content Type. The Fields can cover data ranging from single variables and text lines to media files or blocks of formatted text.
General information about a Content item is stored in a
ContentInfo does not include Fields. It contains following information:
id - the unique ID of the Content object. These numbers are not recycled, so if an item is deleted, its ID will not be reused when a new one is created.
contentTypeId - the unique numerical ID of the Content Type, on which the Content item is based.
name - the name is generated automatically based on a pattern specified in the Content Type definition.
The name is in the main language of the Content item.
name is always searchable, even if the Field(s) used to generate it are not.
sectionId - the unique number of the Section to which the Content item belongs.
New Content items are placed in the Standard Section by default.
This behavior can be changed, but content must always belong to some Section.
See Sections for more information.
currentVersionNo - current version number is the number of the published version or of a newly created draft (which is 1).
published - true if a published version exists, otherwise false.
ownerId - ID of the User who initially created the Content item.
It is set by the system the first time the Content item is published.
The ownership of an item cannot be modified and will not change even if the owner is removed from the system.
modificationDate - date and time when the Content item was last modified.
This is set by the system and cannot be modified manually, but will change every time the item is published again.
publishedDate - date and time when the Content item was published for the first time.
This is set by the system and cannot be modified.
alwaysAvailable - indicates if the Content item is shown in the main language when it's not present in another requested language.
It is set per Content Type.
remoteId - a global unique ID of the Content item.
Accepts up to 100 characters. Cannot contain non-printable characters and control sequences (anything in ASCII range
It's recommended to either let this value be generated by the Public PHP API as an MD5 hash, or at least to generate it as a hash (e.g. one from SHA family).
mainLanguageCode - the main language code of the Content item.
alwaysAvailable flag is set to true, the Content item is shown in this language when the requested language does not exist.
mainLocationId - identifier of the Content item's main Location.
status - status of the Content item. It can have three statuses: 0 – draft, 1 – published and 2 – archived.
When an item is created, its status is set to draft. After publishing the status changes to published.
When a published Content item is moved to Trash, the item becomes archived.
If a published item is removed from the Trash (or removed without being put in the Trash first), it is permanently deleted.
The Fields of a Content item are defined by the Content Type to which the Content item belongs. s
A Field is the smallest unit of storage in the content model and the building block of all Content items. Every Field belongs to a Field Type.
Beyond the built-in set of Field Types, you can create your own.
Field value validation¶
The values entered in a Field may undergo validation, which means the system makes sure that they are correct for the chosen Field Type and can be used without a problem.
Validation depends on the settings of a particular Field Type. It cannot be turned off for a Field if its Field Type supports it.
Aside from the Field Type, the Field definition in a Content Type provides the following information:
Name – a user-friendly name that describes the Field. This name is used in the interface, but not internally by the system. It can consist of letters, digits, spaces and special characters; the maximum length is 255 characters. If no name is provided, a unique one is automatically generated.
Identifier – an identifier for internal use in configuration files, templates, PHP code, etc. It can only contain lowercase letters, digits and underscores; the maximum length is 50 characters. This identifier is also used in name patterns for the Content Type.
Description – a detailed description of the Field.
Required – a flag which indicates if the Field is required for the system to accept the Content item. By default, if a Field is flagged as Required, a user will not be able to publish a Content item without filling in this Field.
You can use the
ContentService::validate() method to decide whether the required Fields or whole Content items are checked for
completeness at other stages of the editing process.
The Required flag is in no way related to Field validation. A Field's value is validated whether the Field is set as required or not.
Searchable – a flag which indicates if the value of the Field will be indexed for searching.
The Searchable flag is not available for some Fields, because some Field Types do not allow searching through their values.
Translatable – a flag which indicates if the value of the Field can be translated. This is independent of the Field Type, which means that even Fields such as "Float" or "Image" can be set as translatable.
Depending on the Field Type, there may also be other, specific information to fill in. For example, the "Country" Field Type allows you to select the default country, as well as to allow selecting multiple countries at the same time.
You can disable the possibility to edit specific Field details per Field Type by adding custom service definition for
Each Content item can have multiple versions. Each version has one of the following statuses: draft, archived or published.
A new version is created every time a Content item is edited. The previous published version is not modified.
Only one version can be published at the same time. When you publish a new version, the previous published version changes its status to Archived.
The number of preserved archived versions is set in
By default it is set to 5.
A new version is also created when a new language is added to the Content item.
Products are a special type of content that holds products you can manage in the built-in PIM system.
See PIM for more information.