From a2a1c5fac2c32676514c42e71fc88f2ceae0c70f Mon Sep 17 00:00:00 2001 From: Kevin Ditscheid <kevin.ditscheid@sgalinski.de> Date: Fri, 7 Aug 2020 12:08:04 +0200 Subject: [PATCH] [BUGFIX] Fix broken flexform configuration field --- .../Hooks/PageLayoutView/PluginRenderer.php | 30 ++++++++++--------- .../FlexForms/flexform_sgyoutube_youtube.xml | 2 ++ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Classes/Hooks/PageLayoutView/PluginRenderer.php b/Classes/Hooks/PageLayoutView/PluginRenderer.php index d0a8de4..4096148 100644 --- a/Classes/Hooks/PageLayoutView/PluginRenderer.php +++ b/Classes/Hooks/PageLayoutView/PluginRenderer.php @@ -59,23 +59,25 @@ class PluginRenderer implements PageLayoutViewDrawItemHookInterface { // Set plugin options array $pluginOptions = GeneralUtility::xml2array($row['pi_flexform'], 'T3:'); $templateOptions = []; - foreach ($pluginOptions['data']['sDEF']['lDEF'] as $option => $value) { - if ($option !== 'settings.showApiResult') { - // $option has the format 'settings.<key>', but in the template we want the language label which - // has the format 'flexform.<key>'. - $templateOptions[str_replace('settings.', '', $option)] = $value['vDEF']; + if (is_array($pluginOptions)) { + foreach ($pluginOptions['data']['sDEF']['lDEF'] as $option => $value) { + if ($option !== 'settings.showApiResult') { + // $option has the format 'settings.<key>', but in the template we want the language label which + // has the format 'flexform.<key>'. + $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'] - ); + $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'] - ]); + $view->assignMultiple([ + 'pluginOptions' => $templateOptions, + 'showApiResult' => $pluginOptions['data']['sDEF']['lDEF']['settings.showApiResult']['vDEF'] + ]); + } // Content element labels $pluginName = BackendUtility::getLabelFromItemListMerged( diff --git a/Configuration/FlexForms/flexform_sgyoutube_youtube.xml b/Configuration/FlexForms/flexform_sgyoutube_youtube.xml index 5522d30..167177c 100644 --- a/Configuration/FlexForms/flexform_sgyoutube_youtube.xml +++ b/Configuration/FlexForms/flexform_sgyoutube_youtube.xml @@ -58,6 +58,7 @@ <label>LLL:EXT:sg_youtube/Resources/Private/Language/locallang.xlf:flexform.aspectRatio</label> <config> <type>select</type> + <renderType>selectSingle</renderType> <items type="array"> <numIndex index="0" type="array"> <numIndex index="0">16:9</numIndex> @@ -76,6 +77,7 @@ <label>LLL:EXT:sg_youtube/Resources/Private/Language/locallang.xlf:flexform.thumbnailType</label> <config> <type>select</type> + <renderType>selectSingle</renderType> <items type="array"> <numIndex index="0" type="array"> <numIndex index="0">LLL:EXT:sg_youtube/Resources/Private/Language/locallang.xlf:flexform.thumbnailType.byAspectRatio</numIndex> -- GitLab