/** * Delete the page * * @param stdClass $nodeData * @return array */ public function deleteNode($nodeData) { /** @var $node t3lib_tree_pagetree_Node */ $node = t3lib_div::makeInstance('t3lib_tree_pagetree_Node', (array) $nodeData); try { t3lib_tree_pagetree_Commands::deleteNode($node); $returnValue = array(); if ($GLOBALS['BE_USER']->workspace) { $record = t3lib_tree_pagetree_Commands::getNodeRecord($node->getId()); if ($record['_ORIG_uid']) { $newNode = t3lib_tree_pagetree_Commands::getNewNode($record); $returnValue = $newNode->toArray(); } } } catch (Exception $exception) { $returnValue = array('success' => FALSE, 'message' => $exception->getMessage()); } return $returnValue; }
/** * Returns the page tree mounts for the current user * * Note: If you add the search filter parameter, the nodes will be filtered by this string. * * @param string $searchFilter * @return array */ public function getTreeMounts($searchFilter = '') { /** @var $nodeCollection t3lib_tree_pagetree_NodeCollection */ $nodeCollection = t3lib_div::makeInstance('t3lib_tree_pagetree_NodeCollection'); $isTemporaryMountPoint = FALSE; $mountPoints = intval($GLOBALS['BE_USER']->uc['pageTree_temporaryMountPoint']); if (!$mountPoints) { $mountPoints = array_map('intval', $GLOBALS['BE_USER']->returnWebmounts()); $mountPoints = array_unique($mountPoints); } else { $isTemporaryMountPoint = TRUE; $mountPoints = array($mountPoints); } if (!count($mountPoints)) { return $nodeCollection; } $showRootlineAboveMounts = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPathAboveMounts'); foreach ($mountPoints as $mountPoint) { if ($mountPoint === 0) { $sitename = 'TYPO3'; if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] !== '') { $sitename = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; } $record = array('uid' => 0, 'title' => $sitename); $subNode = t3lib_tree_pagetree_Commands::getNewNode($record); $subNode->setLabelIsEditable(FALSE); $subNode->setType('pages_root'); } else { if (in_array($mountPoint, $this->hiddenRecords)) { continue; } $record = t3lib_BEfunc::getRecordWSOL('pages', $mountPoint, '*', '', TRUE); if (!$record) { continue; } $subNode = t3lib_tree_pagetree_Commands::getNewNode($record, $mountPoint); if ($showRootlineAboveMounts && !$isTemporaryMountPoint) { $rootline = t3lib_tree_pagetree_Commands::getMountPointPath($record['uid']); $subNode->setReadableRootline($rootline); } } if (count($mountPoints) <= 1) { $subNode->setExpanded(TRUE); $subNode->setCls('typo3-pagetree-node-notExpandable'); } $subNode->setIsMountPoint(TRUE); $subNode->setDraggable(FALSE); $subNode->setIsDropTarget(FALSE); if ($searchFilter === '') { $childNodes = $this->getNodes($subNode, $mountPoint); } else { $childNodes = $this->getFilteredNodes($subNode, $searchFilter, $mountPoint); $subNode->setExpanded(TRUE); } $subNode->setChildNodes($childNodes); $nodeCollection->append($subNode); } return $nodeCollection; }