Tree
Tree copied to clipboard
How can I duplicate/propogate children structure of a node
Is it possible to duplicate child of a node with all its subchildren structure? Give example please.
Depends on what you are trying to do. If you want to alter the tree, then there is no built-in support for this, as the library is aimed at read-only access to tree data.
However, nothing keeps you from doing something like this:
$nodeToBeCloned = $tree->getNodeById($idOfNodeToBeCloned);
$clone = clone $nodeToBeCloned;
$nodeToBeCloned->getParent()->addChild($clone);
(And by the way: sorry for the late answer. Chances are that you don’t need it anymore …)