Skip to content
Snippets Groups Projects
Commit a2a1c5fa authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[BUGFIX] Fix broken flexform configuration field

parent 4cb2b5bb
No related branches found
No related tags found
1 merge request!1[FEATURE] Add backend preview for the YouTube Videos plugin
......@@ -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(
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment