Neos\Neos\Service\View\NodeView::assignNodeAndChildNodes PHP Метод

assignNodeAndChildNodes() публичный Метод

Prepares this view to render a list or tree of given node including child nodes.
public assignNodeAndChildNodes ( Neos\ContentRepository\Domain\Model\NodeInterface $node, string $nodeTypeFilter = '', integer $depth, Neos\ContentRepository\Domain\Model\NodeInterface $untilNode = null ) : void
$node Neos\ContentRepository\Domain\Model\NodeInterface The node to fetch child nodes of
$nodeTypeFilter string Criteria for filtering the child nodes
$depth integer How many levels of childNodes (0 = unlimited)
$untilNode Neos\ContentRepository\Domain\Model\NodeInterface if given, expand all nodes on the rootline towards $untilNode, no matter what is defined with $depth.
Результат void
    public function assignNodeAndChildNodes(NodeInterface $node, $nodeTypeFilter = '', $depth = 0, NodeInterface $untilNode = null)
    {
        $this->outputStyle = self::STYLE_TREE;
        $data = array();
        if ($this->privilegeManager->isGranted(NodeTreePrivilege::class, new NodePrivilegeSubject($node))) {
            $childNodes = array();
            $this->collectChildNodeData($childNodes, $node, $nodeTypeFilter === '' ? null : $nodeTypeFilter, $depth, $untilNode);
            $data = $this->collectTreeNodeData($node, true, $childNodes, $childNodes !== array());
        }
        $this->setConfiguration(array('value' => array('data' => array('_descendAll' => array()))));
        $this->assign('value', array('data' => $data, 'success' => true));
    }

Usage Example

Пример #1
0
 /**
  * Creates a new node and returns tree structure
  *
  * @param Node $referenceNode
  * @param array $nodeData
  * @param string $position where the node should be added, -1 is before, 0 is in, 1 is after
  * @param string $nodeTypeFilter
  * @return void
  */
 public function createNodeForTheTreeAction(Node $referenceNode, array $nodeData, $position, $nodeTypeFilter = '')
 {
     $newNode = $this->nodeOperations->create($referenceNode, $nodeData, $position);
     $this->view->assignNodeAndChildNodes($newNode, $nodeTypeFilter);
 }