l3pp4rd/DoctrineExtensions — Issue #218: Support node criteria for childrenHierarchy
Author: PorridgeBear
Created: 2011-12-31 15:33:48+00:00
State: open

Forgive me if I have not read the instructions correctly, but there doesn't seem to be a way in which I can generate different html trees based on general node properties.

For example, my node contains 2 boolean field (enabled, requestable). Within my application's admin I want to show the full tree, but in my frontend I only want the tree to show enabled, requestable nodes.

It seems like I should be able to specify a criteria array to childrenHierarchy so this work is done in the database query.

Another way would be to add another option to childrenHierarchy options called, e.g. include, that allows me to return a true or false as to whether to include the node in the tree.

````php
$options = array(
'include' => function($node) { return $node['enabled'] && $node['requestable']; }
````

However I think the database criteria method offers the most flexibility.

Thanks