Skip to the content
Documentation

same_classattribute_node

No ratings yet

Summary

Fetches nodes containing attributes that match a certain value.

Usage

fetch( 'content', 'same_classattribute_node',
       hash( 'classattribute_id', classattribute_id,
             'value',              value,
	     'datatype',           datatype ) )

Parameters

Name Type Description Required
id integer The ID number of the class attribute that should be examined. Yes.
value mixed The value that should be matched. Yes.
datatype string Must be either "int", "float" or "text". Yes.

Returns

An array of ezcontentobjecttreenode objects or FALSE.

Description

This function will go through all object attributes that are instances of the class attribute specified by the "classattribute_id" parameter. The value that should be matched must be specified using the "value" parameter. In addition, the type of data (either "int", "float" or "text") that the datatype representing the attribute must be provided. The function returns an array of ezcontentobjecttreenode objects or FALSE (if there is no match).

Examples

{def $matched_nodes=fetch( 'content', 'same_classattribute_node',
                           hash( 'classattribute_id', 245,
                                 'value',              'example',
                                 'datatype',           'text' ) )}

{foreach $matched_nodes as $matched_node}
    {$matched_node.name|wash} <br />
{/foreach}

Outputs the names of the nodes that make use of class attribute number 245 and where the text contents of the object attribute equals the string "example".

Changed in Exponential 6.0.15

The parameters of fetch( 'content', 'same_classattribute_node' ) as kernel/content/function_definition.php of Exponential 6.0.15 defines them (eZContentFunctionCollection::fetchSameClassAttributeNodeList()):

Parameter Change
classattribute_id Defined in 6.0.15 (type integer, required: Yes.); this page did not list it.
id Not a parameter of same_classattribute_node in kernel/content/function_definition.php of 6.0.15.

Contributors

Comments (2 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. Wrong Hash Parameter in Doku

    Florian Fruehstueck ·

    Be careful, the correct parameter in the hash is "classattribute_id" NOT "class_attribute_id" as stated!
    {let object=fetch( 'content', 'same_classattribute_node', hash( 'classattribute_id', '524', 'value', '1025', 'datatype', 'int' ) )}

    1. Re: Wrong Hash Parameter in Doku

      Peter ·

      Thanks for pointing that out! I've now changed those listings to "classattribute_id".

Comments

Add a comment

Comments are read by a moderator before they appear.