Neos\Neos\Ui\TypoScript\Helper\NodeInfoHelper::renderNode PHP Method

renderNode() public method

public renderNode ( TYPO3\TYPO3CR\Domain\Model\NodeInterface $node, TYPO3\Flow\Mvc\Controller\ControllerContext $controllerContext )
$node TYPO3\TYPO3CR\Domain\Model\NodeInterface
$controllerContext TYPO3\Flow\Mvc\Controller\ControllerContext
    public function renderNode(NodeInterface $node, ControllerContext $controllerContext)
    {
        $nodeInfo = ['contextPath' => $node->getContextPath(), 'name' => $node->getName(), 'identifier' => $node->getIdentifier(), 'nodeType' => $node->getNodeType()->getName(), 'properties' => $this->buildNodeProperties($node), 'label' => $node->getLabel(), 'isAutoCreated' => $node->isAutoCreated(), 'children' => []];
        if ($node->getNodeType()->isOfType('TYPO3.Neos:Document')) {
            $nodeInfo['uri'] = $this->uri($node, $controllerContext);
        }
        foreach ($node->getChildNodes() as $childNode) {
            /* @var NodeInterface $childNode */
            $nodeInfo['children'][] = ['contextPath' => $childNode->getContextPath(), 'nodeType' => $childNode->getNodeType()->getName()];
        }
        return $nodeInfo;
    }

Usage Example

Example #1
0
 /**
  * Serialize node and all child nodes
  *
  * @param NodeInterface $node
  * @param array $list
  * @return array
  */
 public function serializeNodeRecursively(NodeInterface $node, ControllerContext $controllerContext)
 {
     $result = [$node->getContextPath() => $this->nodeInfoHelper->renderNode($node, $controllerContext)];
     foreach ($node->getChildNodes() as $childNode) {
         $result = array_merge($result, $this->serializeNodeRecursively($childNode, $controllerContext));
     }
     return $result;
 }