/** * Inserts a new node directly after the destination node and returns the created node. * * @param stdClass $parentNodeData * @param int $destination * @param int $pageType * @return array */ public function insertNodeAfterDestination($parentNodeData, $destination, $pageType) { /** @var $parentNode \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */ $parentNode = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode::class, (array) $parentNodeData); try { $newPageId = Commands::createNode($parentNode, -$destination, $pageType); $returnValue = Commands::getNode($newPageId)->toArray(); } catch (\Exception $exception) { $returnValue = array('success' => false, 'message' => $exception->getMessage()); } return $returnValue; }