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

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

Prepares this view to render a list or tree of child nodes of the given node.
public assignChildNodes ( Neos\ContentRepository\Domain\Model\NodeInterface $node, string $nodeTypeFilter, integer $outputStyle = self::STYLE_LIST, 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
$outputStyle integer Either STYLE_TREE or STYLE_list
$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 assignChildNodes(NodeInterface $node, $nodeTypeFilter, $outputStyle = self::STYLE_LIST, $depth = 0, NodeInterface $untilNode = null)
    {
        $this->outputStyle = $outputStyle;
        $nodes = array();
        if ($this->privilegeManager->isGranted(NodeTreePrivilege::class, new NodePrivilegeSubject($node))) {
            $this->collectChildNodeData($nodes, $node, $nodeTypeFilter === '' ? null : $nodeTypeFilter, $depth, $untilNode);
        }
        $this->setConfiguration(array('value' => array('data' => array('_descendAll' => array()))));
        $this->assign('value', array('data' => $nodes, 'success' => true));
    }

Usage Example

Пример #1
0
 /**
  * Return child nodes of specified node for usage in a TreeLoader
  *
  * @param Node $node The node to find child nodes for
  * @param string $nodeTypeFilter A node type filter
  * @param integer $depth levels of childNodes (0 = unlimited)
  * @param Node $untilNode expand the child nodes until $untilNode is reached, independent of $depth
  * @return void
  */
 public function getChildNodesForTreeAction(Node $node, $nodeTypeFilter, $depth, Node $untilNode)
 {
     $this->view->assignChildNodes($node, $nodeTypeFilter, NodeView::STYLE_TREE, $depth, $untilNode);
 }