Swat/SwatTreeFlydown.php
private function flattenTree(
        &$options,
        SwatTreeFlydownNode $node,
        $level = 0,
        $path = array()
    ) {
        $tree_option = clone $node->getOption();

        $pad = str_repeat('&nbsp;', $level * 3);
        $path[] = $tree_option->value;

        $tree_option->title = $pad . $tree_option->title;
        $tree_option->value = $path;

        $options[] = $tree_option;

        foreach ($node->getChildren() as $child_node) {
            $this->flattenTree($options, $child_node, $level + 1, $path);
        }
    }
private function flattenTree(
        &$options,
        SwatTreeFlydownNode $node,
        $level = 0,
        $path = array()
    ) {
        $tree_option = clone $node->getOption();

        $pad = str_repeat('&nbsp;', $level * 3);
        $path[] = $tree_option->value;

        $tree_option->title = $pad . $tree_option->title;
        $tree_option->value = $path;

        $options[] = $tree_option;

        foreach ($node->getChildren() as $child_node) {
            $this->flattenTree($options, $child_node, $level + 1, $path);
        }
    }
private function flattenTree ( & $ options , SwatTreeFlydownNode $ node , $ level = 0 , $ path = array ( ) ) { $ tree_option = clone $ node -> getOption ( ) ; $ pad = str_repeat ( '&nbsp;' , $ level * 3 ) ; $ path [ ] = $ tree_option -> value ; $ tree_option -> title = $ pad . $ tree_option -> title ; $ tree_option -> value = $ path ; $ options [ ] = $ tree_option ; foreach ( $ node -> getChildren ( ) as $ child_node ) { $ this -> flattenTree ( $ options , $ child_node , $ level + 1 , $ path ) ; } }
Flattens this flydown's tree into an array of flydown options

The tree is represented by placing spaces in front of option titles for
different levels. The values of the options are set to an array
representing the tree nodes's paths in the tree.

@param array $options a reference to an array to add the flattened tree
nodes to.
@param SwatTreeFlydownNode $node the tree node to flatten.
@param integer $level the current level of recursion.
@param array $path the current path represented as an array of tree
node option values.
Flattens this flydown s tree into an array of flydown options