src/ORM/Hierarchy/MarkedSet.php
protected function getSubtree($node, $depth = 0)
    {
        // Check if this node is limited due to child count
        $numChildren = $this->getNumChildren($node);
        $limited = $this->isNodeLimited($node, $numChildren);

        // Build root rode
        $expanded = $this->isExpanded($node);
        $opened = $this->isTreeOpened($node);
        $count = ($limited && $numChildren > $this->getMaxChildNodes()) ? 0 : $numChildren;
        $output = [
            'node' => $node,
            'marked' => $this->isMarked($node),
            'expanded' => $expanded,
            'opened' => $opened,
            'depth' => $depth,
            'count' => $count, // Count of DB children
            'limited' => $limited, // Flag whether 'items' has been limited
            'children' => [], // Children to return in this request
        ];

        // Don't iterate children if past limit
        // or not expanded (requires subsequent request to get)
        if ($limited || !$expanded) {
            return $output;
        }

        // Get children
        $children = $this->getChildren($node);
        foreach ($children as $child) {
            // Recurse
            if ($this->isMarked($child)) {
                $output['children'][] = $this->getSubtree($child, $depth + 1);
            }
        }
        return $output;
    }
protected function getSubtree($node, $depth = 0)
    {
        // Check if this node is limited due to child count
        $numChildren = $this->getNumChildren($node);
        $limited = $this->isNodeLimited($node, $numChildren);

        // Build root rode
        $expanded = $this->isExpanded($node);
        $opened = $this->isTreeOpened($node);
        $count = ($limited && $numChildren > $this->getMaxChildNodes()) ? 0 : $numChildren;
        $output = [
            'node' => $node,
            'marked' => $this->isMarked($node),
            'expanded' => $expanded,
            'opened' => $opened,
            'depth' => $depth,
            'count' => $count, // Count of DB children
            'limited' => $limited, // Flag whether 'items' has been limited
            'children' => [], // Children to return in this request
        ];

        // Don't iterate children if past limit
        // or not expanded (requires subsequent request to get)
        if ($limited || !$expanded) {
            return $output;
        }

        // Get children
        $children = $this->getChildren($node);
        foreach ($children as $child) {
            // Recurse
            if ($this->isMarked($child)) {
                $output['children'][] = $this->getSubtree($child, $depth + 1);
            }
        }
        return $output;
    }
protected function getSubtree ( $ node , $ depth = 0 ) { // Check if this node is limited due to child count $ numChildren = $ this -> getNumChildren ( $ node ) ; $ limited = $ this -> isNodeLimited ( $ node , $ numChildren ) ; // Build root rode $ expanded = $ this -> isExpanded ( $ node ) ; $ opened = $ this -> isTreeOpened ( $ node ) ; $ count = ( $ limited && $ numChildren > $ this -> getMaxChildNodes ( ) ) ? 0 : $ numChildren ; $ output = [ 'node' => $ node , 'marked' => $ this -> isMarked ( $ node ) , 'expanded' => $ expanded , 'opened' => $ opened , 'depth' => $ depth , 'count' => $ count , // Count of DB children 'limited' => $ limited , // Flag whether 'items' has been limited 'children' => [ ] , // Children to return in this request ] ; // Don't iterate children if past limit // or not expanded (requires subsequent request to get) if ( $ limited || ! $ expanded ) { return $ output ; } // Get children $ children = $ this -> getChildren ( $ node ) ; foreach ( $ children as $ child ) { // Recurse if ( $ this -> isMarked ( $ child ) ) { $ output [ 'children' ] [ ] = $ this -> getSubtree ( $ child , $ depth + 1 ) ; } } return $ output ; }
Get tree data for node

@param DataObject $node
@param int $depth
@return array|string
Get tree data for node