src/ORM/Hierarchy/MarkedSet.php
protected function renderSubtree($data, $template, $context = [])
    {
        // Render children
        $childNodes = new ArrayList();
        foreach ($data['children'] as $child) {
            $childData = $this->renderSubtree($child, $template, $context);
            $childNodes->push($childData);
        }

        // Build parent node
        $parentNode = new ArrayData($data);
        $parentNode->setField('children', $childNodes); // Replace raw array with template-friendly list
        $parentNode->setField('markingClasses', $this->markingClasses($data['node']));

        // Evaluate custom context
        if (!is_string($context) && is_callable($context)) {
            $context = call_user_func($context, $data['node']);
        }
        if ($context) {
            foreach ($context as $key => $value) {
                $parentNode->setField($key, $value);
            }
        }

        // Render
        $subtree = $parentNode->renderWith($template);
        $parentNode->setField('SubTree', $subtree);
        return $parentNode;
    }
protected function renderSubtree($data, $template, $context = [])
    {
        // Render children
        $childNodes = new ArrayList();
        foreach ($data['children'] as $child) {
            $childData = $this->renderSubtree($child, $template, $context);
            $childNodes->push($childData);
        }

        // Build parent node
        $parentNode = new ArrayData($data);
        $parentNode->setField('children', $childNodes); // Replace raw array with template-friendly list
        $parentNode->setField('markingClasses', $this->markingClasses($data['node']));

        // Evaluate custom context
        if (!is_string($context) && is_callable($context)) {
            $context = call_user_func($context, $data['node']);
        }
        if ($context) {
            foreach ($context as $key => $value) {
                $parentNode->setField($key, $value);
            }
        }

        // Render
        $subtree = $parentNode->renderWith($template);
        $parentNode->setField('SubTree', $subtree);
        return $parentNode;
    }
protected function renderSubtree ( $ data , $ template , $ context = [ ] ) { // Render children $ childNodes = new ArrayList ( ) ; foreach ( $ data [ 'children' ] as $ child ) { $ childData = $ this -> renderSubtree ( $ child , $ template , $ context ) ; $ childNodes -> push ( $ childData ) ; } // Build parent node $ parentNode = new ArrayData ( $ data ) ; $ parentNode -> setField ( 'children' , $ childNodes ) ; // Replace raw array with template-friendly list $ parentNode -> setField ( 'markingClasses' , $ this -> markingClasses ( $ data [ 'node' ] ) ) ; // Evaluate custom context if ( ! is_string ( $ context ) && is_callable ( $ context ) ) { $ context = call_user_func ( $ context , $ data [ 'node' ] ) ; } if ( $ context ) { foreach ( $ context as $ key => $ value ) { $ parentNode -> setField ( $ key , $ value ) ; } } // Render $ subtree = $ parentNode -> renderWith ( $ template ) ; $ parentNode -> setField ( 'SubTree' , $ subtree ) ; return $ parentNode ; }
Render a node in the tree with the given template

@param array $data array data for current node
@param string|array $template Template to use
@param array|callable $context Additional arguments to add to template when rendering
due to excessive line length. If callable, this will be executed with the current node dataobject
@return ArrayData Viewable object representing the root node. use getField('SubTree') to get HTML
Render a node in the tree with the given template