Skip to content

Content model

Content model overview

The content structure in Ibexa DXP is based on content items. A content item represents a single piece of content, for example, an article, a blog post, an image, or a product. Each content item is an instance of a content type.

Tip

An introduction to the content model for non-developer users is available in User Documentation](https://doc.ibexa.co/projects/userguide/en/latest/content_management/content_model/).

Content items

A content item consists of:

Content information

General information about a content item is stored in a ContentInfo object. ContentInfo doesn't include fields. It contains following information:

id - the unique ID of the Content object. These numbers aren't recycled, so if an item is deleted, its ID isn't 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.

Note

name is always searchable, even if the field(s) used to generate it aren't.

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.

For more information, see Sections.

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's set by the system the first time the content item is published. The ownership of an item cannot be modified and doesn't change even if the owner is removed from the system.

modificationDate - date and time when the content item was last modified. It's set by the system and cannot be modified manually, but changes every time the item is published again.

publishedDate - date and time when the content item was published for the first time. It's 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's 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 \x00 - \x1F). 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 (for example, one from SHA family).

mainLanguageCode - the main language code of the content item. If the alwaysAvailable flag is set to true, the content item is shown in this language when the requested language doesn't 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's permanently deleted.

Diagram of an example content item

The fields of a content item are defined by the content type to which the content item belongs.

Fields

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're 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.

Field details

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, for example, in configuration files, templates, or PHP code. 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 isn't able to publish a content item without filling in this field.

Note

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 is indexed for searching.

The Searchable flag isn't available for some fields, because some field types don't allow searching through their values.

Translatable – a flag which indicates if the value of the field can be translated. It's 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, and to allow selecting multiple countries at the same time.

Diagram of content model

Tip

You can disable the possibility to edit specific field details per field type by adding custom service definition for ModifyFieldDefinitionsCollectionTypeExtension.

Content versions

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 isn't 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 ibexa.repositories.default.options.default_version_archive_limit. By default it's set to 5.

A new version is also created when a new language is added to the content item.

Products

Products are a special type of content that holds products you can manage in the built-in PIM system.

For more information, see PIM.