version_list
Summary
Fetches all the versions of a content object.Usage
fetch( 'content', 'version_list', hash( 'contentobject', object, [ 'offset', offset, ] [ 'limit', limit ] [ 'sorts', sorts ] ) )
Parameters
Name | Type | Description | Required |
---|---|---|---|
contentobject | object | The target object. | Yes. |
offset | integer | Offset to start at. | No. |
limit | integer | The number of versions that should be fetched. | No. |
sorts | array | A new parameter since eZ Publish 4.1 which enables you to sort the returned versions | No. |
Returns
An array of ezcontentobjectversion objects.
Description
This function fetches all the versions of a certain object. The object itself must be specified using the "contentobject" parameter. The "offset" and "limit" parameters are optional and can be used to limit the result. The function returns an array of ezcontentobjectversion objects.
Examples
Example 1
{* Fetch object number 13. *} {def $object=fetch( 'content', 'object', hash( 'object_id', 13 ) )} {* Fetch all the versions of object number 13. *} {def $versions=fetch( 'content', 'version_list', hash( 'contentobject', $object ) )} {* Loop through all versions and display their names. *} {foreach $versions as $version} {$version.name} <br /> {/foreach}
Outputs the names of all versions that belong to object number 13.
Example 2
fetch('content', 'version_list', hash('sorts', array(...)))</pre>
Balazs Halasy (06/02/2004 12:16 pm)
Ester Heylen (18/11/2009 3:37 pm)
Comments
There are no comments.