contentobject_attributes
Summary
Fetches the attributes of an object's version (and translation).
Usage
fetch( 'content', 'contentobject_attributes',
hash( 'version', version,
[ 'language_code', language_code ] ) )Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| version | object | The target version (must be an ezcontentobjectversion object). | Yes. |
| language_code | string | The language code. | No. |
Returns
An array of ezcontentobjectattribute objects or FALSE.
Description
This function fetches the attributes that belong to a certain version. The version must be provided (as an ezcontentobjectversion) using the "version" parameter. The "language_code" parameter is optional and can be used to get the attributes that belong to a specific translation. The function returns an array of ezcontentobjectattribute objects or FALSE if something went wrong.
Examples
Example 1
{def $object=fetch( 'content', 'object', hash( 'object_id', 14 ) )
$attributes=fetch( 'content, 'contentobject_attributes',
hash( 'version', $object.current ) )}
{foreach $attributes as $attribute}
{$attribute.data_type_string} <br />
{/foreach}Outputs the names of the datatypes that are used by the different attributes within the current version of object number 14.
Changed in Exponential 6.0.15
The parameters of fetch( 'content', 'contentobject_attributes' ) as kernel/content/function_definition.php of Exponential 6.0.15 defines them (eZContentFunctionCollection::contentobjectAttributes()):
| Parameter | Change |
|---|---|
| version | Required in 6.0.15: No. (this page: Yes.) |
Contributors
- Balazs Halasy
- Michael Zielinski Commenter
- Jean Gaudel Commenter
- Graham Brookins Updated
Comments (2 historical)
Written by readers of the earlier documentation sites, kept as they were.
possible error
Michael Zielinski ·
I had to seperate the example into to queries to get it to work.
syntax error
Jean Gaudel ·
Missing a quote in exemple 1 :
{def $object=fetch( 'content', 'object', hash( 'object_id', 14 ) )
$attributes=fetch( 'content, 'contentobject_attributes',
hash( 'version', $object.current ) )}
it should be :
{def $object=fetch( 'content', 'object', hash( 'object_id', 14 ) )
$attributes=fetch( 'content', 'contentobject_attributes',
hash( 'version', $object.current ) )}