list_count
Summary
Fetches the number of children of a node.
Usage
fetch( 'content', 'list_count',
hash( 'parent_node_id', parent_node_id,
[ 'class_filter_type', class_filter_type, ]
[ 'class_filter_array', class_filter_array, ]
[ 'attribute_filter', attribute_filter, ]
[ 'extended_attribute_filter', extended_attribute_filter, ]
[ 'main_node_only', main_node_only, ] ) )Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| parent_node_id | integer | The ID number of the parent node. | Yes. |
| class_filter_type | string | The type of class filtering (include/exclude). | No. |
| class_filter_array | array | The classes that should be filtered. | No. |
| attribute_filter | mixed | Filter logic for attribute level filtering. | No. |
| extended_attribute_filter | mixed | The extended attribute level filter logic. | No. |
| main_node_only | integer | Type of nodes that should be fetched (all or main nodes only). | No. |
Returns
An integer (the number of nodes).
Description
This function operates in almost the same way as the "list" fetch function. The difference is that instead of returning the actual nodes, it returns the count (the number of nodes that were found). The "list_count" function takes the same parameters as the "list" function with some exceptions (sorting, grouping, limit/offset, etc. is not supported). Please refer to the documentation of the "list" function for a detailed description of the parameters.
Examples
Example 1
{def $count=fetch( 'content', 'list_count', hash( 'parent_node_id', 42 ) )}
Node number 42 has {$count} number of children.Outputs the number of nodes that are below node number 42.
Changed in Exponential 6.0.15
The parameters of fetch( 'content', 'list_count' ) as kernel/content/function_definition.php of Exponential 6.0.15 defines them (eZContentFunctionCollection::fetchObjectTreeCount()):
| Parameter | Change |
|---|---|
| only_translated | Defined in 6.0.15 (type bool, required: No., default false); this page did not list it. |
| language | Defined in 6.0.15 (type string, required: No., default false); this page did not list it. |
| depth | Defined in 6.0.15 (type string, required: No., default 1); this page did not list it. |
| depth_operator | Defined in 6.0.15 (type string, required: No., default "le"); this page did not list it. |
| ignore_visibility | Defined in 6.0.15 (type bool, required: No., default false); this page did not list it. |
| limitation | Defined in 6.0.15 (type array, required: No.); this page did not list it. |
| objectname_filter | Defined in 6.0.15 (type string, required: No.); this page did not list it. |
Contributors
- Balazs Halasy Maintainer
- Svitlana Shatokhina Maintainer
- Graham Brookins Updated
Comments
Add a comment