/** * Updates the given field with a new text value, may be used to inline update * the title field in the new page tree * * @param stdClass $nodeData * @param string $updatedLabel * @return array */ public function updateLabel($nodeData, $updatedLabel) { if ($updatedLabel === '') { return array(); } /** @var $node \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */ $node = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode::class, (array) $nodeData); try { Commands::updateNodeLabel($node, $updatedLabel); $shortendedText = GeneralUtility::fixed_lgd_cs($updatedLabel, (int) $GLOBALS['BE_USER']->uc['titleLen']); $returnValue = array('editableText' => $updatedLabel, 'updatedText' => htmlspecialchars($shortendedText)); } catch (\Exception $exception) { $returnValue = array('success' => false, 'message' => $exception->getMessage()); } return $returnValue; }
/** * Updates the given field with a new text value, may be used to inline update * the title field in the new page tree * * @param \stdClass $nodeData * @param string $updatedLabel * @return array */ public function updateLabel($nodeData, $updatedLabel) { if ($updatedLabel === '') { return []; } /** @var $node PagetreeNode */ $node = GeneralUtility::makeInstance(PagetreeNode::class, (array) $nodeData); try { Commands::updateNodeLabel($node, $updatedLabel); $shortendedText = GeneralUtility::fixed_lgd_cs($updatedLabel, (int) static::getBackendUser()->uc['titleLen']); $returnValue = ['editableText' => $updatedLabel, 'updatedText' => htmlspecialchars($shortendedText)]; } catch (\Exception $exception) { $returnValue = ['success' => false, 'message' => $exception->getMessage()]; } return $returnValue; }