Skip to content

Commit 0c5e793

Browse files
Florianflorianleimer
authored andcommitted
[BUGFIX] Prevent removal of FlexForm settings
1 parent 1af4ef4 commit 0c5e793

1 file changed

Lines changed: 2 additions & 26 deletions

File tree

Classes/Updates/SwitchableControllerActionsPluginUpdater.php

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,11 @@ public function performMigration(): bool
101101
$record['list_type'],
102102
$flexForm['switchableControllerActions']
103103
);
104-
$allowedSettings = $this->getAllowedSettingsFromFlexForm($targetListType);
105104

106105
// Remove flexform data which do not exist in flexform of new plugin
107106
foreach ($flexFormData['data'] as $sheetKey => $sheetData) {
108-
foreach ($sheetData['lDEF'] as $settingName => $setting) {
109-
if (!in_array($settingName, $allowedSettings, true)) {
110-
unset($flexFormData['data'][$sheetKey]['lDEF'][$settingName]);
111-
}
107+
if (isset($sheetData['lDEF']['switchableControllerActions'])) {
108+
unset($flexFormData['data'][$sheetKey]['lDEF']['switchableControllerActions']);
112109
}
113110

114111
// Remove empty sheets
@@ -163,27 +160,6 @@ protected function getTargetListType(string $sourceListType, string $switchableC
163160
return '';
164161
}
165162

166-
protected function getAllowedSettingsFromFlexForm(string $listType): array
167-
{
168-
if (isset($GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds'][$listType . ',list']) === false) {
169-
return [];
170-
}
171-
172-
$flexFormFile = $GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds'][$listType . ',list'];
173-
$flexFormContent = file_get_contents(GeneralUtility::getFileAbsFileName(substr(trim((string)$flexFormFile), 5)));
174-
$flexFormData = GeneralUtility::xml2array($flexFormContent);
175-
176-
// Iterate each sheet and extract all settings
177-
$settings = [];
178-
foreach ($flexFormData['sheets'] as $sheet) {
179-
foreach ($sheet['ROOT']['el'] as $setting => $tceForms) {
180-
$settings[] = $setting;
181-
}
182-
}
183-
184-
return $settings;
185-
}
186-
187163
/**
188164
* Updates list_type and pi_flexform of the given content element UID
189165
*

0 commit comments

Comments
 (0)