Sulu\Bundle\ContentBundle\Repository\NodeRepository::prepareNodesTree PHP Метод

prepareNodesTree() приватный Метод

private prepareNodesTree ( Sulu\Component\Content\Compat\StructureInterface[] $nodes, string $webspaceKey, string $languageCode, boolean $complete = true, boolean $excludeGhosts = false, $maxDepth = 1, $currentDepth ) : array
$nodes Sulu\Component\Content\Compat\StructureInterface[]
$webspaceKey string
$languageCode string
$complete boolean
$excludeGhosts boolean
Результат array
    private function prepareNodesTree($nodes, $webspaceKey, $languageCode, $complete = true, $excludeGhosts = false, $maxDepth = 1, $currentDepth = 0)
    {
        ++$currentDepth;
        $results = [];
        foreach ($nodes as $node) {
            $result = $this->prepareNode($node, $webspaceKey, $languageCode, 1, $complete, $excludeGhosts);
            if ($maxDepth !== null && $currentDepth < $maxDepth && $node->getHasChildren() && $node->getChildren() != null) {
                $result['_embedded']['nodes'] = $this->prepareNodesTree($node->getChildren(), $webspaceKey, $languageCode, $complete, $excludeGhosts, $maxDepth, $currentDepth);
            }
            $results[] = $result;
        }
        return $results;
    }