Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 2 additions & 26 deletions Classes/Updates/SwitchableControllerActionsPluginUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,11 @@ public function performMigration(): bool
$record['list_type'],
$flexForm['switchableControllerActions']
);
$allowedSettings = $this->getAllowedSettingsFromFlexForm($targetListType);

// Remove flexform data which do not exist in flexform of new plugin
foreach ($flexFormData['data'] as $sheetKey => $sheetData) {
foreach ($sheetData['lDEF'] as $settingName => $setting) {
if (!in_array($settingName, $allowedSettings, true)) {
unset($flexFormData['data'][$sheetKey]['lDEF'][$settingName]);
}
if (isset($sheetData['lDEF']['switchableControllerActions'])) {
unset($flexFormData['data'][$sheetKey]['lDEF']['switchableControllerActions']);
}

// Remove empty sheets
Expand Down Expand Up @@ -163,27 +160,6 @@ protected function getTargetListType(string $sourceListType, string $switchableC
return '';
}

protected function getAllowedSettingsFromFlexForm(string $listType): array
{
if (isset($GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds'][$listType . ',list']) === false) {
return [];
}

$flexFormFile = $GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds'][$listType . ',list'];
$flexFormContent = file_get_contents(GeneralUtility::getFileAbsFileName(substr(trim((string)$flexFormFile), 5)));
$flexFormData = GeneralUtility::xml2array($flexFormContent);

// Iterate each sheet and extract all settings
$settings = [];
foreach ($flexFormData['sheets'] as $sheet) {
foreach ($sheet['ROOT']['el'] as $setting => $tceForms) {
$settings[] = $setting;
}
}

return $settings;
}

/**
* Updates list_type and pi_flexform of the given content element UID
*
Expand Down