/** * Shows a single item * * @todo integrate caching framework * @return void */ public function showAction() { // Modifies the Render Object $this->cleanRenderObj($this->settings); // Load the data if (empty($this->settings['renderMethod']) || !isset($this->settings['renderMethod'])) { $this->settings['renderMethod'] = 'flexForm'; } $cObjAr =& $this->settings['flexform']; // Append extra static fields if (sizeof($this->settings['cObjectStaticData.']) > 0) { foreach ($this->settings['cObjectStaticData.'] as $key => $val) { $cObjAr[$key] = $val; } } // Content Object loading $this->cObj = $this->configurationManager->getContentObject(); // temp save of the original data // Load the content object data $data = $this->cObj->data; // Merge the CD Data with the current data object if (is_array($cObjAr)) { $this->cObj->start(array_merge($data, $cObjAr)); } else { $this->cObj->start($data); } // Execute rendering by TypoScript $itemContent = \KERN23\ContentDesigner\Service\TypoScript::parseTypoScriptObj($this->settings['renderObj'], $this->settings['renderObj.'], $this->cObj); // Reset to default data object $this->cObj->start($data, 'tt_content'); // Reset the DATA with the original data // Return result return $itemContent; }
/** * Renders the typoscript preview object with the data from the flexform * * @param $cObjAr * @param $itemContent * @param $row * @param $objType * @param $objArray */ private function parsePreview(&$cObjAr, &$itemContent, &$row, &$objType, &$objArray) { // initialize TSFE $cObj = TypoScript::cObjInit(); // TypoScript FIELD Startpoint set $cObj->start(array_merge($row, $cObjAr)); // Render preview with TypoScript $itemContent = TypoScript::parseTypoScriptObj($objType, $objArray, $cObj); // Reset $cObj->start($row, 'tt_content'); // Reset des CURRENT Wert damit die Content ID wieder eingefuegt werden kann // Initializing of TypoScript overrides the backend backPath... so we need to set it back for the backend $pageRenderer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class); $backPath = TYPO3_MODE === 'BE' ? $GLOBALS['BACK_PATH'] : ''; # same way as done in: \TYPO3\CMS\Core\Resource\ResourceCompresso->setInitialBackPath() $pageRenderer->setBackPath($backPath); // free memory unset($cObj, $pageRenderer, $backPath); }