/** * Flatten the tree to a list of data objects. * * @return array similar to what was passed to EE_Tree::load */ public function toList(TreeNode $tree) { $it = $tree->getPreorderIterator(); $result = array(); foreach ($it as $node) { $result[] = $node->getData(); } return $result; }