/** * Moves the source node directly after the destination node * * @param stdClass $nodeData * @param int $destination * @return void */ public function moveNodeAfterDestination($nodeData, $destination) { /** @var $node \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */ $node = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode::class, (array) $nodeData); try { Commands::moveNode($node, -$destination); $newNode = Commands::getNode($node->getId(), false); $newNode->setLeaf($node->isLeafNode()); $returnValue = $newNode->toArray(); } catch (\Exception $exception) { $returnValue = array('success' => false, 'message' => $exception->getMessage()); } return $returnValue; }
/** * Moves the source node directly after the destination node * * @param stdClass $nodeData * @param integer $destination * @return void */ public function moveNodeAfterDestination($nodeData, $destination) { /** @var $node \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */ $node = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\Pagetree\\PagetreeNode', (array) $nodeData); try { \TYPO3\CMS\Backend\Tree\Pagetree\Commands::moveNode($node, -$destination); $newNode = \TYPO3\CMS\Backend\Tree\Pagetree\Commands::getNode($node->getId(), FALSE); $newNode->setLeaf($node->isLeafNode()); $returnValue = $newNode->toArray(); } catch (\Exception $exception) { $returnValue = array('success' => FALSE, 'message' => $exception->getMessage()); } return $returnValue; }