diff --git a/Classes/Hooks/PageLayoutView/PluginRenderer.php b/Classes/Hooks/PageLayoutView/PluginRenderer.php new file mode 100644 index 0000000000000000000000000000000000000000..40961485e18cff7afc078cbf19c06bc027785298 --- /dev/null +++ b/Classes/Hooks/PageLayoutView/PluginRenderer.php @@ -0,0 +1,91 @@ +setTemplateRootPaths(['EXT:sg_youtube/Resources/Private/Templates/Youtube']); + $view->setTemplate('Backend.html'); + $view->assign('uid', $row['uid']); + + // Set plugin options array + $pluginOptions = GeneralUtility::xml2array($row['pi_flexform'], 'T3:'); + $templateOptions = []; + if (is_array($pluginOptions)) { + foreach ($pluginOptions['data']['sDEF']['lDEF'] as $option => $value) { + if ($option !== 'settings.showApiResult') { + // $option has the format 'settings.', but in the template we want the language label which + // has the format 'flexform.'. + $templateOptions[str_replace('settings.', '', $option)] = $value['vDEF']; + } + } + + $languageService = GeneralUtility::makeInstance(LanguageService::class); + $templateOptions['flexform.thumbnailType'] = $languageService->sL( + 'LLL:EXT:sg_youtube/Resources/Private/Language/locallang.xlf:flexform.thumbnailType.' . $templateOptions['flexform.thumbnailType'] + ); + + $view->assignMultiple([ + 'pluginOptions' => $templateOptions, + 'showApiResult' => $pluginOptions['data']['sDEF']['lDEF']['settings.showApiResult']['vDEF'] + ]); + } + + // Content element labels + $pluginName = BackendUtility::getLabelFromItemListMerged( + $row['pid'], 'tt_content', 'list_type', $row['list_type'] + ); + $headerContent = '[' . $pluginName . '] ' . $headerContent; + + $itemContent .= $view->render(); + } + } +} diff --git a/Configuration/FlexForms/flexform_sgyoutube_youtube.xml b/Configuration/FlexForms/flexform_sgyoutube_youtube.xml index e2d3945f14d904bda8f1ee49ff6ece9b0d1bd918..167177cf0d68901edb4ed6d6a1f9ae56f922f467 100644 --- a/Configuration/FlexForms/flexform_sgyoutube_youtube.xml +++ b/Configuration/FlexForms/flexform_sgyoutube_youtube.xml @@ -16,7 +16,7 @@ 0 -