/** * Fetches the next tree level * * @param integer $nodeId * @param \stdClass $nodeData * @return array */ public function getNextTreeLevel($nodeId, $nodeData) { $this->initDataProvider(); /** @var $node \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */ $node = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\Pagetree\\PagetreeNode', (array) $nodeData); if ($nodeId === 'root') { $nodeCollection = $this->dataProvider->getTreeMounts(); } else { $nodeCollection = $this->dataProvider->getNodes($node, $node->getMountPoint()); } return $nodeCollection->toArray(); }
/** * Returns a tree that only contains elements that match the given search string * * @param integer $nodeId * @param stdClass $nodeData * @param string $searchFilter * @return array */ public function getFilteredTree($nodeId, $nodeData, $searchFilter) { if (strval($searchFilter) === '') { return array(); } /** @var $node \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */ $node = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\Pagetree\\PagetreeNode', (array) $nodeData); $this->initDataProvider(); if ($nodeId === 'root') { $nodeCollection = $this->dataProvider->getTreeMounts($searchFilter); } else { $nodeCollection = $this->dataProvider->getFilteredNodes($node, $searchFilter, $node->getMountPoint()); } return $nodeCollection->toArray(); }
/** * @test */ public function getRootNodeReturnsExpandedNode() { $this->assertTrue($this->fixture->getRoot()->isExpanded()); }