The content object
A content object is one piece of content: an article, a folder, an image, a user account. It is an instance of a content class and holds a value for each of the class's attributes. Objects are never edited in place: every change is made in a new version, and an object can hold its content in several languages.
What an object has
| Property | Meaning |
|---|---|
| Object ID | A number that never changes (ezcontentobject.id). |
| Remote ID | A unique text ID, kept when content moves between installations by packages or migrations. |
| Class | The type of the object; fixed when it is created. |
| Name | Made from the class's object name pattern, one per language. |
| Owner | The user who created it; policies can be limited to "own" content. |
| Section | One section, whatever the number of locations. |
| Object states | One state of each state group (for example a review state), usable in policies. |
| Published and modified dates | When it was first published and last changed. |
| Current version | The number of the published version. |
| Languages | Its translations, its main language and the always-available flag. See Multiple languages. |
| Locations | Its nodes in the content tree; an object can have several, and the first is the main one. |
Versions
Editing an object makes a new version, a copy of the latest one, as a draft. Only the user who made a draft edits it. Publishing the draft makes it the current version; the version that was published before becomes archived and stays in the version history, where it can be viewed, compared, copied into a new draft and published again.
| Version status | Meaning |
|---|---|
| Draft | Being edited; not visible on the site. Unfinished drafts are listed under My account > My drafts (/content/draft). |
| Pending | Sent for publishing and waiting, for example for an approval workflow. |
| Published | The current version, the one visitors see. |
| Archived | A version that was published before. |
| Rejected | Refused by an approver; its author can edit it again and send it once more. |
| Internal draft | A draft the system made but nobody has saved yet (an edit form that was opened and left); the cronjob internal_drafts_cleanup.php removes old ones. |
| Queued | Waiting to be published by the asynchronous publishing queue, when content.ini [PublishingSettings] AsynchronousPublishing is enabled. |
How many archived versions an object keeps is set in content.ini [VersionManagement]: DefaultVersionHistoryLimit (45) and, per class, VersionHistoryClass[<class id>] (folders keep 75). When an object reaches the limit, the oldest archived version is removed on the next publish. The Content history and Drafts and pending guides show the pages for this.
Object status: published, draft, in the trash
The object itself is a draft until its first version is published, then published. Removing it to the trash removes its nodes and marks the object archived: it keeps its versions and can be restored from the trash (/content/trash) with its location. Emptying the trash deletes it for good.
Where it is stored
| Table | Holds |
|---|---|
| ezcontentobject | One row per object: class, owner, section, current version, language mask, remote ID. |
| ezcontentobject_version | One row per version: status, creator, dates, initial language. |
| ezcontentobject_attribute | One row per attribute, version and language: the content itself. |
| ezcontentobject_name | The object's name per version and language. |
| ezcontentobject_tree | The nodes of published objects; eznode_assignment holds the locations a draft will get. |
In templates, an object is reached from its node ($node.object) or fetched directly:
{def $object = fetch( 'content', 'object', hash( 'object_id', 1234 ) )}
{$object.name|wash} ({$object.class_identifier}), version {$object.current_version}
{$object.main_node.url_alias|ezurl}
{undef $object}
Contributors
- Balazs Halasy
- Ricardo Correia Maintainer
- Geir Arne Waaler Maintainer
- Graham Brookins Updated Maintainer
Comments
Add a comment