2 namespace TYPO3\CMS\Fluid\ViewHelpers;
74 $this->typoScriptSetup = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
87 public function render($typoscriptObjectPath, $data = null, $currentValueKey = null, $table =
'')
89 if (TYPO3_MODE ===
'BE') {
96 if (is_object($data)) {
97 $data = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties($data);
98 }
elseif (is_string($data) || is_numeric($data)) {
99 $currentValue = (string)$data;
100 $data = array($data);
103 $contentObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
104 $contentObject->start($data, $table);
105 if ($currentValue !== null) {
106 $contentObject->setCurrentVal($currentValue);
107 }
elseif ($currentValueKey !== null && isset($data[$currentValueKey])) {
108 $contentObject->setCurrentVal($data[$currentValueKey]);
110 $pathSegments = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(
'.', $typoscriptObjectPath);
111 $lastSegment = array_pop($pathSegments);
113 foreach ($pathSegments as $segment) {
114 if (!array_key_exists(($segment .
'.'), $setup)) {
115 throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception(
'TypoScript object path "' . htmlspecialchars($typoscriptObjectPath) .
'" does not exist', 1253191023);
117 $setup = $setup[$segment .
'.'];
119 $content = $contentObject->cObjGetSingle($setup[$lastSegment], $setup[$lastSegment .
'.']);
120 if (TYPO3_MODE ===
'BE') {
136 $GLOBALS[
'TSFE']->cObjectDepthCounter = 100;