This pipeline is used to augment or modify the count of children of an object.
It is called as show below in the ecrire/inc/rubriques.php file:
- // We pass the table of counts in a pipeline so that the plugins can add (or remove) children
- $compte = pipeline('objet_compte_enfants',
- 'args' => array(
- 'objet' => 'rubrique',
- 'id_objet' => $id_rubrique,
- 'statut' => 'publie',
- 'date' => $date
- 'data' => $compte
It accepts an argument which is the object for which you wish to count children using the
id_objet parameters. It can also be passed the status of the children that you want to be used to filter the count.
In the call above, we requested a count of the "published" children in a specific section.
data contents of the pipeline is an associative array, with the key being the type of object in the plural (e.g. "articles"), and the value being an integer which matches the number of children of that type.