Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Content attribute and version reference

Every attribute a template can read from a content object attribute (eZContentObjectAttribute, the items of data_map) and from a version (eZContentObjectVersion), with the PHP method behind each, values from a…

Download as PDF

Address: https://doc.exponential.earth/learninminutes/exphelp/viewer/help/template-language/content-attribute-reference.md

On this page

Content attribute and version reference

The values of data_map are eZContentObjectAttribute objects (kernel/classes/ezcontentobjectattribute.php): one field of one version in one language. A version is an eZContentObjectVersion (kernel/classes/ezcontentobjectversion.php), reached through $object.current or $object.versions. This page lists what templates can read from both, and what content is for each datatype.

Contents

  1. Content object attribute: database fields
  2. Content object attribute: function attributes
  3. What content returns, per datatype
  4. Version: database fields
  5. Version: function attributes
  6. Notes
  7. Related pages

The tables were made like the node attributes table: definition() listed and every name read on a development installation, here on the title attribute and the current version of node 96 (object 94, an ng_article).

Content object attribute: database fields

AttributeDatabase column / memberDatatypeValue on a development installation (node 96)
idIDintegerinteger 580
contentobject_idContentObjectIDintegerinteger 94
versionVersionintegerinteger 1
language_codeLanguageCodestringstring "eng-US"
language_idLanguageIDintegerinteger 2
contentclassattribute_idContentClassAttributeIDintegerinteger 334
attribute_original_idAttributeOriginalIDintegerinteger 0
sort_key_intSortKeyIntintegerinteger 0
sort_key_stringSortKeyStringstringstring "why should you choose strength training?"
data_type_stringDataTypeStringstringstring "ezstring"
data_textDataTexttextstring "Why Should You Choose Strength Training?"
data_intDataIntintegernull
data_floatDataFloatfloatdouble 0.0

The fields data_text, data_int and data_float are the raw storage. Which one a datatype uses, and how, is the datatype's business: ezstring keeps its text in data_text and leaves data_int empty (null above); eZContentObjectAttribute::attribute() turns a null data_text into '' so templates never see null there.

Content object attribute: function attributes

Function attributePHP methodValue on a development installation (node 96)
contentclass_attributeeZContentObjectAttribute::contentClassAttribute()object eZContentClassAttribute
contentclass_attribute_identifiereZContentObjectAttribute::contentClassAttributeIdentifier()string "title"
contentclass_attribute_nameeZContentObjectAttribute::contentClassAttributeName()string "Title"
can_translateeZContentObjectAttribute::contentClassAttributeCanTranslate()integer 1
is_information_collectoreZContentObjectAttribute::contentClassAttributeIsInformationCollector()integer 0
is_requiredeZContentObjectAttribute::contentClassAttributeIsRequired()integer 1
contenteZContentObjectAttribute::content()string "Why Should You Choose Strength Training?"
has_http_valueeZContentObjectAttribute::hasHTTPValue()boolean false
valueeZContentObjectAttribute::value()string "Why Should You Choose Strength Training?"
has_contenteZContentObjectAttribute::hasContent()boolean true
class_contenteZContentObjectAttribute::classContent()string ""
objecteZContentObjectAttribute::object()object eZContentObject
object_versioneZContentObjectAttribute::objectVersion()object eZContentObjectVersion
view_templateeZContentObjectAttribute::viewTemplateName()string "ezstring"
edit_templateeZContentObjectAttribute::editTemplateName()string "ezstring"
result_templateeZContentObjectAttribute::resultTemplate()string "ezstring"
has_validation_erroreZContentObjectAttribute::hasValidationError()boolean false
validation_erroreZContentObjectAttribute::validationError()null
validation_logeZContentObjectAttribute::validationLog()null
languageeZContentObjectAttribute::language()object eZContentObjectAttribute
is_aeZContentObjectAttribute::isA()string "ezstring"
display_infoeZContentObjectAttribute::displayInfo()array(4) of array
class_display_infoeZContentObjectAttribute::classDisplayInfo()array(2) of array

A sample:

{def $attribute = fetch( 'content', 'node', hash( 'node_id', 96 ) ).data_map.title}
id / version / language: {$attribute.id} / {$attribute.version} / {$attribute.language_code}
class attribute:         {$attribute.contentclass_attribute_identifier} "{$attribute.contentclass_attribute_name|wash}" ({$attribute.contentclassattribute_id})
datatype:                {$attribute.data_type_string}, is_a: {$attribute.is_a}
required / translatable: {$attribute.is_required} / {$attribute.can_translate}
templates:               view {$attribute.view_template}, edit {$attribute.edit_template}
stored:                  data_text "{$attribute.data_text|wash}", sort_key_string "{$attribute.sort_key_string|wash}"

Output:

id / version / language: 580 / 1 / eng-US
class attribute:         title "Title" (334)
datatype:                ezstring, is_a: ezstring
required / translatable: 1 / 1
templates:               view ezstring, edit ezstring
stored:                  data_text "Why Should You Choose Strength Training?", sort_key_string "why should you choose strength training?"

What content returns, per datatype

content calls eZContentObjectAttribute::content(), which asks the datatype's objectAttributeContent() once and keeps the result on the attribute. This template walked the first 150 nodes below the Fit & Healthy front page on a development installation and printed, for each datatype the first time it had content, what content returned:

{def $seen = array()}
{foreach fetch( 'content', 'tree', hash( 'parent_node_id', 89, 'limit', 150 ) ) as $node}{foreach $node.data_map as $attribute}{if and( $attribute.has_content, $seen|contains( $attribute.data_type_string )|not )}{set $seen = $seen|append( $attribute.data_type_string )}{$attribute.data_type_string}: {if is_object( $attribute.content )}object {$attribute.content|get_class}{else}{$attribute.content|get_type|explode( '[' )|extract_left( 1 )|implode( '' )}{/if} ({$node.class_identifier}.{$attribute.contentclass_attribute_identifier})

{/if}{/foreach}{/foreach}

Output:

ezstring: string (ng_article.title)
ezxmltext: object ezxmltext (ng_article.teaser_intro)
xrowmetadata: object xrowmetadata (ng_article.metadata)
eztags: object eztags (ng_landing_page.tags)
ezimage: object ezimagealiashandler (ng_article.image)
ezobjectrelationlist: array (ng_article.authors)
ezdatetime: object ezdatetime (ng_blog_post.publish_date)
ezinteger: integer (ng_gallery.column_count)
ezboolean: integer (ng_category.show_children)
ezemail: string (ng_contact_form.recipient)
ngenhancedlink: object ngenhancedlinkvalue (ng_component_hero.link_1)
ezbinaryfile: object ezbinaryfile (ng_video.video_file)
ezmedia: object ezmedia (ng_audio.file)
eztext: string (ng_htmlbox.html_code)
ezurl: string (ng_site_info.facebook)
ezprice: object ezprice (product.price)
ezsrrating: object ezsrratingobject (product.rating)
ezmatrix: object ezmatrix (product.specifications)
Datatypecontent on a development installationDatatype page
ezstring, eztext, ezemail, ezurlstring (for ezurl the URL)ezstring, eztext, ezemail, ezurl
ezinteger, ezbooleanintegerezinteger, ezboolean
ezxmltexteZXMLText object; .output.output_text is the rendered HTMLezxmltext
ezimageeZImageAliasHandler; .original, [alias name]ezimage
ezobjectrelationlistarray with the key relation_listezobjectrelationlist
ezdatetimeeZDateTime objectezdatetime
ezbinaryfileeZBinaryFile objectezbinaryfile
ezmediaeZMedia objectezmedia
ezpriceeZPrice objectezprice
ezmatrixeZMatrix objectezmatrix
eztagseZTags object (extension eztags)
xrowmetadataxrowMetaData object (extension xrowmetadata)
ngenhancedlinkngEnhancedLinkValue object (extension exp_enhanced_link)
ezsrratingezsrRatingObject (extension ezstarrating)

get_class lower-cases class names, so the example shows ezimagealiashandler for eZImageAliasHandler. The Data map and content page reads several of these contents in detail.

Version: database fields

AttributeDatabase column / memberDatatypeValue on a development installation (node 96)
idIDintegerinteger 544
contentobject_idContentObjectIDintegerinteger 94
creator_idCreatorIDintegerinteger 14
versionVersionintegerinteger 1
statusStatusintegerinteger 1
createdCreatedintegerinteger 1600936225
modifiedModifiedintegerinteger 1600936234
workflow_event_posWorkflowEventPosintegerinteger 0
user_idUserIDintegerinteger 0
language_maskLanguageMaskintegerinteger 2
initial_language_idInitialLanguageIDintegerinteger 2

status is the version status: eZContentObjectVersion::STATUS_DRAFT (0), STATUS_PUBLISHED (1), STATUS_PENDING (2), STATUS_ARCHIVED (3), STATUS_REJECTED (4), STATUS_INTERNAL_DRAFT (5), STATUS_REPEAT (6), STATUS_QUEUED (7).

Version: function attributes

Function attributePHP methodValue on a development installation (node 96)
creatoreZContentObjectVersion::creator()object eZContentObject
nameeZContentObjectVersion::name()string "Why Should You Choose Strength Training?"
version_nameeZContentObjectVersion::versionName()string "Why Should You Choose Strength Training?"
main_parent_node_ideZContentObjectVersion::mainParentNodeID()integer 92
contentobject_attributeseZContentObjectVersion::contentObjectAttributes()array(18) of eZContentObjectAttribute
related_contentobject_arrayeZContentObjectVersion::relatedContentObjectArray()array(0)
reverse_related_object_listeZContentObjectVersion::reverseRelatedObjectList()array(0)
parent_nodeseZContentObjectVersion::parentNodes()array(1) of eZNodeAssignment
can_readeZContentObjectVersion::canVersionRead()boolean false
can_removeeZContentObjectVersion::canVersionRemove()boolean false
data_mapeZContentObjectVersion::dataMap()array(18) of eZContentObjectAttribute
node_assignmentseZContentObjectVersion::nodeAssignments()array(1) of eZNodeAssignment
contentobjecteZContentObjectVersion::contentObject()object eZContentObject
initial_languageeZContentObjectVersion::initialLanguage()object eZContentLanguage
language_listeZContentObjectVersion::translations()array(1) of eZContentObjectTranslation
translationeZContentObjectVersion::translation()boolean false
translation_listeZContentObjectVersion::defaultTranslationList()array(1) of eZContentObjectTranslation
complete_translation_listeZContentObjectVersion::translationList()array(1) of eZContentObjectTranslation
temp_main_nodeeZContentObjectVersion::tempMainNode()object eZContentObjectTreeNode

A sample:

{def $version = fetch( 'content', 'node', hash( 'node_id', 96 ) ).object.current}
version {$version.version}, status {$version.status}, created {$version.created|datetime( 'custom', '%Y-%m-%d' )}
name in this version: {$version.version_name|wash}
translations: {foreach $version.translation_list as $t}{$t.language_code}{delimiter}, {/delimiter}{/foreach}

creator object id: {$version.creator_id}

Output:

version 1, status 1, created 2020-09-24
name in this version: Why Should You Choose Strength Training?
translations: eng-US
creator object id: 14

Notes

  • language returns the same attribute in another language: without a language code, the object's initial language (eZContentObjectAttribute::language()).
  • view_template and edit_template are the names (without .tpl) that attribute_view_gui and attribute_edit_gui look for below content/datatype/view/ and content/datatype/edit/; for an information collector attribute view_template returns the collector template instead.
  • class_content is the content of the class attribute (the field's settings, such as a selection's options).
  • has_content comes from the datatype's hasObjectAttributeContent(). Most datatypes return a boolean; the ezimage datatype returned an empty string for an image field without an image on a development installation (see The template compiler for why that matters with choose).
  • The can_read and can_remove of a version check the current user's content/versionread and content/versionremove policies; as the anonymous user both were false.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x