eZ Object States Filter

UNIX name Owner Status
ezobjectstatesfilter Damien Pobel stable
Version Compatible with
1.0 4.1, 4.2, 4.3
ezobjectstatesfilter extension provides an extended attribute filter to filter on object states

ezobjectstatesfilter extension provides an extended attribute filter to filter on object states.

Setup

  1. Download the archive
  2. Unpack it in the extension folder of eZ Publish 4.1
  3. Activate the extension through the admin interface

Use

Templates

In templates, you can now use fetch( content, list ) to retrieve objects filtered by one or several object states :

{def $nodes=fetch( content, list, hash( parent_node_id, $node_id,
extended_attribute_filter, hash( 'id', 'ObjectStateFilter',
'params', hash( 'states_identifiers', array( 'group_identifier/state_identifier',
'another_group/another_state' ),
'operator', 'and' ) ) ) )}

This code will return only content object tree nodes that contain a content object having group_identifier/state_identifier and another_group/another_state states.

The operator value should be 'and' either 'or', if it's omitted, the default value is 'and'.

PHP

Extended attribute filters are also available in the PHP API in eZContentObjectTreeNode::subTreeByNodeID() :


$statesIdentifiers = array( 'comment_status/rejected',
'comment_status/waited' );
$param = array( 'ClassFilterType' => 'include',
'ClassFilterArray' => array( 'comment' ),
'ExtendedAttributeFilter' => array( 'id' => 'ObjectStateFilter',
'params' => array( 'states_identifiers' => $statesIdentifiers,
'operator' => 'or' ) ) );
$waitedRejectedComments = eZContentObjectTreeNode::subTreeByNodeID( $param, $BaseNodeID );

?>

This project has no reviews yet. Be the first one to review it!