X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/blobdiff_plain/a55bdfe4dd08e4f70722c9d8ce6706e2812d24ed..db6f8fd215c955be897b1a118416b02b4e8913f4:/typo3/sysext/core/Classes/Migrations/TcaMigration.php diff --git a/typo3/sysext/core/Classes/Migrations/TcaMigration.php b/typo3/sysext/core/Classes/Migrations/TcaMigration.php index b5a8f5786951..d0eb08c211e7 100644 --- a/typo3/sysext/core/Classes/Migrations/TcaMigration.php +++ b/typo3/sysext/core/Classes/Migrations/TcaMigration.php @@ -49,17 +49,6 @@ class TcaMigration $this->validateTcaType($tca); $tca = $this->migrateColumnsConfig($tca); - $tca = $this->migrateT3editorWizardToRenderTypeT3editorIfNotEnabledByTypeConfig($tca); - $tca = $this->migrateSpecialConfigurationAndRemoveShowItemStylePointerConfig($tca); - $tca = $this->migrateT3editorWizardWithEnabledByTypeConfigToColumnsOverrides($tca); - $tca = $this->migrateShowItemAdditionalPaletteToOwnPalette($tca); - $tca = $this->migrateIconsForFormFieldWizardToNewLocation($tca); - $tca = $this->migrateExtAndSysextPathToEXTPath($tca); - $tca = $this->migrateIconsInOptionTags($tca); - $tca = $this->migrateIconfileRelativePathOrFilenameOnlyToExtReference($tca); - $tca = $this->migrateSelectFieldRenderType($tca); - $tca = $this->migrateSelectFieldIconTable($tca); - $tca = $this->migrateElementBrowserWizardToLinkHandler($tca); $tca = $this->migrateDefaultExtrasRteTransFormOptions($tca); $tca = $this->migrateSelectTreeOptions($tca); $tca = $this->migrateTSconfigSoftReferences($tca); @@ -86,7 +75,7 @@ class TcaMigration $tca = $this->migrateOptionsOfTypeGroup($tca); $tca = $this->migrateSelectShowIconTable($tca); $tca = $this->migrateImageManipulationConfig($tca); - $tca = $this->migrateinputDateTimeMax($tca); + $tca = $this->migrateInputDateTimeMax($tca); $tca = $this->migrateInlineOverrideChildTca($tca); $tca = $this->migrateLocalizeChildrenAtParentLocalization($tca); $tca = $this->migratePagesLanguageOverlayRemoval($tca); @@ -153,587 +142,6 @@ class TcaMigration return $tca; } - /** - * Migrate type=text field with t3editor wizard to renderType=t3editor without this wizard - * - * @param array $tca Incoming TCA - * @return array Migrated TCA - */ - protected function migrateT3editorWizardToRenderTypeT3editorIfNotEnabledByTypeConfig(array $tca): array - { - $newTca = $tca; - foreach ($tca as $table => $tableDefinition) { - if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) { - continue; - } - foreach ($tableDefinition['columns'] as $fieldName => $fieldConfig) { - if ( - !empty($fieldConfig['config']['type']) // type is set - && trim($fieldConfig['config']['type']) === 'text' // to "text" - && isset($fieldConfig['config']['wizards']) - && is_array($fieldConfig['config']['wizards']) // and there are wizards - ) { - foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) { - if ( - !empty($wizardConfig['userFunc']) // a userFunc is defined - && trim($wizardConfig['userFunc']) === 'TYPO3\\CMS\\T3editor\\FormWizard->main' // and set to FormWizard - && ( - !isset($wizardConfig['enableByTypeConfig']) // and enableByTypeConfig is not set - || (isset($wizardConfig['enableByTypeConfig']) && !$wizardConfig['enableByTypeConfig']) // or set, but not enabled - ) - ) { - // Set renderType from text to t3editor - $newTca[$table]['columns'][$fieldName]['config']['renderType'] = 't3editor'; - // Unset this wizard definition - unset($newTca[$table]['columns'][$fieldName]['config']['wizards'][$wizardName]); - // Move format parameter - if (!empty($wizardConfig['params']['format'])) { - $newTca[$table]['columns'][$fieldName]['config']['format'] = $wizardConfig['params']['format']; - } - $this->messages[] = 'The t3editor wizard using \'type\' = \'text\' has been migrated to a \'renderType\' = \'t3editor\' definition.' - . 'It has been migrated from TCA "' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'t3editor\']"' - . 'to "' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'renderType\'] = \'t3editor\'"'; - } - } - // If no wizard is left after migration, unset the whole sub array - if (empty($newTca[$table]['columns'][$fieldName]['config']['wizards'])) { - unset($newTca[$table]['columns'][$fieldName]['config']['wizards']); - } - } - } - } - return $newTca; - } - - /** - * Remove "style pointer", the 5th parameter from "types" "showitem" configuration. - * Move "specConf", 4th parameter from "types" "showitem" to "types" "columnsOverrides". - * - * @param array $tca Incoming TCA - * @return array Modified TCA - */ - protected function migrateSpecialConfigurationAndRemoveShowItemStylePointerConfig(array $tca): array - { - $newTca = $tca; - foreach ($tca as $table => $tableDefinition) { - if (!isset($tableDefinition['types']) || !is_array($tableDefinition['types'])) { - continue; - } - foreach ($tableDefinition['types'] as $typeName => $typeArray) { - if (!isset($typeArray['showitem']) || !is_string($typeArray['showitem']) || strpos($typeArray['showitem'], ';') === false) { - // Continue directly if no semicolon is found - continue; - } - $itemList = GeneralUtility::trimExplode(',', $typeArray['showitem'], true); - $newFieldStrings = []; - foreach ($itemList as $fieldString) { - $fieldString = rtrim($fieldString, ';'); - // Unpack the field definition, migrate and remove as much as possible - // Keep empty parameters in trimExplode here (third parameter FALSE), so position is not changed - $fieldArray = GeneralUtility::trimExplode(';', $fieldString); - $fieldArray = [ - 'fieldName' => $fieldArray[0] ?? '', - 'fieldLabel' => $fieldArray[1] ?? null, - 'paletteName' => $fieldArray[2] ?? null, - 'fieldExtra' => $fieldArray[3] ?? null, - ]; - if (!empty($fieldArray['fieldExtra'])) { - // Move fieldExtra "specConf" to columnsOverrides "defaultExtras" - if (!isset($newTca[$table]['types'][$typeName]['columnsOverrides'])) { - $newTca[$table]['types'][$typeName]['columnsOverrides'] = []; - } - if (!isset($newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldArray['fieldName']])) { - $newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldArray['fieldName']] = []; - } - // Merge with given defaultExtras from columns. - // They will be the first part of the string, so if "specConf" from types changes the same settings, - // those will override settings from defaultExtras of columns - $newDefaultExtras = []; - if (!empty($tca[$table]['columns'][$fieldArray['fieldName']]['defaultExtras'])) { - $newDefaultExtras[] = $tca[$table]['columns'][$fieldArray['fieldName']]['defaultExtras']; - } - $newDefaultExtras[] = $fieldArray['fieldExtra']; - $newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldArray['fieldName']]['defaultExtras'] = implode(':', $newDefaultExtras); - } - unset($fieldArray['fieldExtra']); - if (count($fieldArray) === 3 && empty($fieldArray['paletteName'])) { - unset($fieldArray['paletteName']); - } - if (count($fieldArray) === 2 && empty($fieldArray['fieldLabel'])) { - unset($fieldArray['fieldLabel']); - } - $newFieldString = implode(';', $fieldArray); - if ($newFieldString !== $fieldString) { - $this->messages[] = 'The 4th parameter \'specConf\' of the field \'showitem\' with fieldName = \'' . $fieldArray['fieldName'] . '\' has been migrated, from TCA table "' - . $table . '[\'types\'][\'' . $typeName . '\'][\'showitem\']"' . 'to "' - . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldArray['fieldName'] . '\'][\'defaultExtras\']".'; - } - if (count($fieldArray) === 1 && empty($fieldArray['fieldName'])) { - // The field may vanish if nothing is left - unset($fieldArray['fieldName']); - } - if (!empty($newFieldString)) { - $newFieldStrings[] = $newFieldString; - } - } - $newTca[$table]['types'][$typeName]['showitem'] = implode(',', $newFieldStrings); - } - } - return $newTca; - } - - /** - * Migrate type=text field with t3editor wizard that is "enableByTypeConfig" to columnsOverrides - * with renderType=t3editor - * - * @param array $tca Incoming TCA - * @return array Migrated TCA - */ - protected function migrateT3editorWizardWithEnabledByTypeConfigToColumnsOverrides(array $tca): array - { - $newTca = $tca; - foreach ($tca as $table => $tableDefinition) { - if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) { - continue; - } - foreach ($tableDefinition['columns'] as $fieldName => $fieldConfig) { - if ( - !empty($fieldConfig['config']['type']) // type is set - && trim($fieldConfig['config']['type']) === 'text' // to "text" - && isset($fieldConfig['config']['wizards']) - && is_array($fieldConfig['config']['wizards']) // and there are wizards - ) { - foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) { - if ( - !empty($wizardConfig['userFunc']) // a userFunc is defined - && trim($wizardConfig['userFunc']) === 'TYPO3\CMS\T3editor\FormWizard->main' // and set to FormWizard - && !empty($wizardConfig['enableByTypeConfig']) // and enableByTypeConfig is enabled - ) { - // Remove this wizard - unset($newTca[$table]['columns'][$fieldName]['config']['wizards'][$wizardName]); - // Find configured types that use this wizard - if (!isset($tableDefinition['types']) || !is_array($tableDefinition['types'])) { - // No type definition at all ... continue directly - continue; - } - foreach ($tableDefinition['types'] as $typeName => $typeArray) { - if ( - empty($typeArray['columnsOverrides'][$fieldName]['defaultExtras']) - || strpos($typeArray['columnsOverrides'][$fieldName]['defaultExtras'], $wizardName) === false - ) { - // Continue directly if this wizard is not enabled for given type - continue; - } - $defaultExtras = $typeArray['columnsOverrides'][$fieldName]['defaultExtras']; - $defaultExtrasArray = GeneralUtility::trimExplode(':', $defaultExtras, true); - $newDefaultExtrasArray = []; - foreach ($defaultExtrasArray as $fieldExtraField) { - // There might be multiple enabled wizards separated by | ... split them - if (strpos($fieldExtraField, 'wizards[') === 0) { - $enabledWizards = substr($fieldExtraField, 8, strlen($fieldExtraField) - 8); // Cut off "wizards[ - $enabledWizards = substr($enabledWizards, 0, strlen($enabledWizards) - 1); - $enabledWizardsArray = GeneralUtility::trimExplode('|', $enabledWizards, true); - $newEnabledWizardsArray = []; - foreach ($enabledWizardsArray as $enabledWizardName) { - if ($enabledWizardName === $wizardName) { - // Found a columnsOverrides configuration that has this wizard enabled - // Force renderType = t3editor - $newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldName]['config']['renderType'] = 't3editor'; - // Transfer format option if given - if (!empty($wizardConfig['params']['format'])) { - $newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldName]['config']['format'] = $wizardConfig['params']['format']; - } - $this->messages[] = 'The t3editor wizard using \'type\' = \'text\', with the "enableByTypeConfig" wizard set to 1,' - . 'has been migrated to the \'renderType\' = \'t3editor\' definition.' - . 'It has been migrated from TCA "' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'t3editor\']"' - . 'to "' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'renderType\'] = \'t3editor\'"'; - } else { - // Some other enabled wizard - $newEnabledWizardsArray[] = $enabledWizardName; - } - } - if (!empty($newEnabledWizardsArray)) { - $newDefaultExtrasArray[] = 'wizards[' . implode('|', $newEnabledWizardsArray) . ']'; - } - } else { - $newDefaultExtrasArray[] = $fieldExtraField; - } - } - if (!empty($newDefaultExtrasArray)) { - $newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldName]['defaultExtras'] = implode(':', $newDefaultExtrasArray); - } else { - unset($newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldName]['defaultExtras']); - } - } - } - } - // If no wizard is left after migration, unset the whole sub array - if (empty($newTca[$table]['columns'][$fieldName]['config']['wizards'])) { - unset($newTca[$table]['columns'][$fieldName]['config']['wizards']); - } - } - } - } - return $newTca; - } - - /** - * Migrate types showitem 'aField;aLabel;aPalette' to 'afield;aLabel, --palette--;;aPalette' - * - * Old showitem can have a syntax like: - * fieldName;aLabel;aPalette - * This way, the palette with name "aPalette" is rendered after fieldName. - * The migration parses this to a syntax like: - * fieldName;aLabel, --palette--;;paletteName - * - * @param array $tca Incoming TCA - * @return array Migrated TCA - */ - protected function migrateShowItemAdditionalPaletteToOwnPalette(array $tca): array - { - $newTca = $tca; - foreach ($tca as $table => $tableDefinition) { - if (!isset($tableDefinition['types']) || !is_array($tableDefinition['types'])) { - continue; - } - foreach ($tableDefinition['types'] as $typeName => $typeArray) { - if ( - !isset($typeArray['showitem']) - || !is_string($typeArray['showitem']) - || strpos($typeArray['showitem'], ';') === false // no field parameters - ) { - continue; - } - $itemList = GeneralUtility::trimExplode(',', $typeArray['showitem'], true); - $newFieldStrings = []; - foreach ($itemList as $fieldString) { - $fieldArray = GeneralUtility::trimExplode(';', $fieldString); - $fieldArray = [ - 'fieldName' => $fieldArray[0] ?? '', - 'fieldLabel' => $fieldArray[1] ?? null, - 'paletteName' => $fieldArray[2] ?? null, - ]; - if ($fieldArray['fieldName'] !== '--palette--' && $fieldArray['paletteName'] !== null) { - if ($fieldArray['fieldLabel']) { - $fieldString = $fieldArray['fieldName'] . ';' . $fieldArray['fieldLabel']; - } else { - $fieldString = $fieldArray['fieldName']; - } - $paletteString = '--palette--;;' . $fieldArray['paletteName']; - $this->messages[] = 'Migrated \'showitem\' field from TCA table ' - . $table . '[\'types\'][\'' . $typeName . '\']" : Moved additional palette' - . ' with name "' . $table . '[\'types\'][\'' . $typeName . '\'][\'' . $fieldArray['paletteName'] . '\']" as 3rd argument of field "' - . $table . '[\'types\'][\'' . $typeName . '\'][\'' . $fieldArray['fieldName'] . '\']"' - . 'to an own palette. The result of this part is: "' . $fieldString . ', ' . $paletteString . '"'; - $newFieldStrings[] = $fieldString; - $newFieldStrings[] = $paletteString; - } else { - $newFieldStrings[] = $fieldString; - } - } - $newTca[$table]['types'][$typeName]['showitem'] = implode(',', $newFieldStrings); - } - } - return $newTca; - } - - /** - * Migrate core icons for form field wizard to new location - * - * @param array $tca Incoming TCA - * @return array Migrated TCA - */ - protected function migrateIconsForFormFieldWizardToNewLocation(array $tca): array - { - $newTca = $tca; - - $newFileLocations = [ - 'add.gif' => 'actions-add', - 'link_popup.gif' => 'actions-wizard-link', - 'wizard_rte2.gif' => 'actions-wizard-rte', - 'wizard_table.gif' => 'content-table', - 'edit2.gif' => 'actions-open', - 'list.gif' => 'actions-system-list-open', - 'wizard_forms.gif' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_forms.gif', - 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_add.gif' => 'actions-add', - 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_table.gif' => 'content-table', - 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_edit.gif' => 'actions-open', - 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_list.gif' => 'actions-system-list-open', - 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_link.gif' => 'actions-wizard-link', - 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_rte.gif' => 'actions-wizard-rte' - ]; - $oldFileNames = array_keys($newFileLocations); - - foreach ($tca as $table => $tableDefinition) { - if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) { - continue; - } - foreach ($tableDefinition['columns'] as $fieldName => $fieldConfig) { - if ( - isset($fieldConfig['config']['wizards']) - && is_array($fieldConfig['config']['wizards']) // and there are wizards - ) { - foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) { - if (!is_array($wizardConfig)) { - continue; - } - - foreach ($wizardConfig as $option => $value) { - if ($option === 'icon' && in_array($value, $oldFileNames, true)) { - $newTca[$table]['columns'][$fieldName]['config']['wizards'][$wizardName]['icon'] = $newFileLocations[$value]; - $this->messages[] = 'The icon path of wizard "' . $wizardName - . '" from TCA table "' - . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\'][\'icon\']"' - . 'has been migrated to ' - . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\'][\'icon\']" = \'' . $newFileLocations[$value] . '\'.'; - } - } - } - } - } - } - - return $newTca; - } - - /** - * Migrate file reference which starts with ext/ or sysext/ to EXT: - * - * @param array $tca Incoming TCA - * @return array Migrated TCA - */ - protected function migrateExtAndSysextPathToEXTPath(array $tca): array - { - foreach ($tca as $table => &$tableDefinition) { - if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) { - continue; - } - foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) { - if ( - !empty($fieldConfig['config']['type']) // type is set - && trim($fieldConfig['config']['type']) === 'select' // to "select" - && isset($fieldConfig['config']['items']) - && is_array($fieldConfig['config']['items']) // and there are items - ) { - foreach ($fieldConfig['config']['items'] as &$itemConfig) { - // more then two values? then the third entry is the image path - if (!empty($itemConfig[2])) { - $tcaPath = implode('.', [$table, 'columns', $fieldName, 'config', 'items']); - $pathParts = GeneralUtility::trimExplode('/', $itemConfig[2]); - // remove first element (ext or sysext) - array_shift($pathParts); - $path = implode('/', $pathParts); - // If the path starts with ext/ or sysext/ migrate it - if ( - strpos($itemConfig[2], 'ext/') === 0 - || strpos($itemConfig[2], 'sysext/') === 0 - ) { - $this->messages[] = '[' . $tcaPath . '] ext/ or sysext/ within the path (' . $path . ') in items array is deprecated, use EXT: reference'; - $itemConfig[2] = 'EXT:' . $path; - } elseif (strpos($itemConfig[2], 'i/') === 0) { - $this->messages[] = '[' . $tcaPath . '] i/ within the path (' . $path . ') in items array is deprecated, use EXT: reference'; - $itemConfig[2] = 'EXT:backend/Resources/Public/Images/' . substr($itemConfig[2], 2); - } - } - } - } - } - } - return $tca; - } - - /** - * Migrate "iconsInOptionTags" for "select" TCA fields - * - * @param array $tca Incoming TCA - * @return array Migrated TCA - */ - protected function migrateIconsInOptionTags(array $tca): array - { - $newTca = $tca; - - foreach ($newTca as $table => &$tableDefinition) { - if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) { - continue; - } - foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) { - if (isset($fieldConfig['config']['iconsInOptionTags'])) { - unset($fieldConfig['config']['iconsInOptionTags']); - $this->messages[] = 'Configuration option \'iconsInOptionTags\' was removed from field "' . $fieldName . '" in TCA table "' . $table . '[\'config\']"'; - } - } - } - - return $newTca; - } - - /** - * Migrate "iconfile" references which starts with ../ to EXT: and consisting of filename only to absolute paths in EXT:t3skin - * - * @param array $tca Incoming TCA - * @return array Migrated TCA - */ - protected function migrateIconfileRelativePathOrFilenameOnlyToExtReference(array $tca): array - { - foreach ($tca as $table => &$tableDefinition) { - if (!isset($tableDefinition['ctrl']) || !is_array($tableDefinition['ctrl'])) { - continue; - } - if (!isset($tableDefinition['ctrl']['iconfile'])) { - continue; - } - if (strpos($tableDefinition['ctrl']['iconfile'], '../typo3conf/ext/') === 0) { - $tableDefinition['ctrl']['iconfile'] = str_replace('../typo3conf/ext/', 'EXT:', $tableDefinition['ctrl']['iconfile']); - $tcaPath = implode('.', [$table, 'ctrl', 'iconfile']); - $this->messages[] = '[' . $tcaPath . '] relative path to ../typo3conf/ext/ is deprecated, use EXT: instead'; - } elseif (strpos($tableDefinition['ctrl']['iconfile'], '/') === false) { - $tableDefinition['ctrl']['iconfile'] = 'EXT:backend/Resources/Public/Images/' . $tableDefinition['ctrl']['iconfile']; - $tcaPath = implode('.', [$table, 'ctrl', 'iconfile']); - $this->messages[] = '[' . $tcaPath . '] filename only is deprecated, use EXT: or absolute reference instead'; - } - } - return $tca; - } - - /** - * Migrate "type=select" with "renderMode=[tree|singlebox|checkbox]" to "renderType=[selectTree|selectSingleBox|selectCheckBox]". - * This migration also take care of "maxitems" settings and set "renderType=[selectSingle|selectMultipleSideBySide]" if no other - * renderType is already set. - * - * @param array $tca - * @return array - */ - public function migrateSelectFieldRenderType(array $tca): array - { - $newTca = $tca; - - foreach ($newTca as $table => &$tableDefinition) { - if (empty($tableDefinition['columns'])) { - continue; - } - - foreach ($tableDefinition['columns'] as $columnName => &$columnDefinition) { - // Only handle select fields. - if (empty($columnDefinition['config']['type']) || $columnDefinition['config']['type'] !== 'select') { - continue; - } - // Do not handle field where the render type is set. - if (!empty($columnDefinition['config']['renderType'])) { - continue; - } - - $tableColumnInfo = 'table "' . $table . '[\'columns\'][\'' . $columnName . '\']"'; - $this->messages[] = 'Using the \'type\' = \'select\' field in "' . $table . '[\'columns\'][\'' . $columnName . '\'][\'config\'][\'type\'] = \'select\'" without the "renderType" setting in "' - . $table . '[\'columns\'][\'' . $columnName . '\'][\'config\'][\'renderType\']" is deprecated.'; - - $columnConfig = &$columnDefinition['config']; - if (!empty($columnConfig['renderMode'])) { - $this->messages[] = 'The "renderMode" setting for select fields is deprecated. Please use "renderType" instead in ' . $tableColumnInfo; - switch ($columnConfig['renderMode']) { - case 'tree': - $columnConfig['renderType'] = 'selectTree'; - break; - case 'singlebox': - $columnConfig['renderType'] = 'selectSingleBox'; - break; - case 'checkbox': - $columnConfig['renderType'] = 'selectCheckBox'; - break; - default: - $this->messages[] = 'The render mode ' . $columnConfig['renderMode'] . ' is invalid for the select field in ' . $tableColumnInfo; - } - continue; - } - - $maxItems = !empty($columnConfig['maxitems']) ? (int)$columnConfig['maxitems'] : 1; - if ($maxItems <= 1) { - $columnConfig['renderType'] = 'selectSingle'; - } else { - $columnConfig['renderType'] = 'selectMultipleSideBySide'; - } - } - } - - return $newTca; - } - - /** - * Migrate the visibility of the icon table for fields with "renderType=selectSingle" - * - * @param array $tca - * @return array Migrated TCA - */ - public function migrateSelectFieldIconTable(array $tca): array - { - foreach ($tca as $table => &$tableDefinition) { - if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) { - continue; - } - foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) { - if (empty($fieldConfig['config']['renderType']) || $fieldConfig['config']['renderType'] !== 'selectSingle') { - continue; - } - if (array_key_exists('noIconsBelowSelect', $fieldConfig['config'])) { - $this->messages[] = 'The "noIconsBelowSelect" setting for select fields in table "' - . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']" was removed. Please define the setting "showIconTable" in table "' - . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'showIconTable\']"'; - if (!$fieldConfig['config']['noIconsBelowSelect']) { - // If old setting was explicitly false, enable icon table if not defined yet - if (!array_key_exists('showIconTable', $fieldConfig['config'])) { - $fieldConfig['config']['showIconTable'] = true; - } - } - unset($fieldConfig['config']['noIconsBelowSelect']); - } - if (array_key_exists('suppress_icons', $fieldConfig['config'])) { - $this->messages[] = 'The "suppress_icons" setting for select fields in table "' - . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']" was removed. Please define the setting "showIconTable" for table "' - . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'showIconTable\']"'; - unset($fieldConfig['config']['suppress_icons']); - } - if (array_key_exists('foreign_table_loadIcons', $fieldConfig['config'])) { - $this->messages[] = 'The "foreign_table_loadIcons" setting for select fields in table "' - . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']" was removed. Please define the setting "showIconTable" for table "' - . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'showIconTable\']"'; - unset($fieldConfig['config']['foreign_table_loadIcons']); - } - } - } - return $tca; - } - - /** - * Migrate wizard "wizard_element_browser" used in mode "wizard" to use the "wizard_link" instead - * - * @param array $tca - * @return array Migrated TCA - */ - protected function migrateElementBrowserWizardToLinkHandler(array $tca): array - { - foreach ($tca as $table => &$tableDefinition) { - if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) { - continue; - } - foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) { - if ( - isset($fieldConfig['config']['wizards']['link']['module']['name']) && $fieldConfig['config']['wizards']['link']['module']['name'] === 'wizard_element_browser' - && isset($fieldConfig['config']['wizards']['link']['module']['urlParameters']['mode']) && $fieldConfig['config']['wizards']['link']['module']['urlParameters']['mode'] === 'wizard' - ) { - $fieldConfig['config']['wizards']['link']['module']['name'] = 'wizard_link'; - unset($fieldConfig['config']['wizards']['link']['module']['urlParameters']['mode']); - if (empty($fieldConfig['config']['wizards']['link']['module']['urlParameters'])) { - unset($fieldConfig['config']['wizards']['link']['module']['urlParameters']); - } - $this->messages[] = 'Reference to "wizard_element_browser" was migrated from "' - . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'link\'][\'module\'][\'name\'] === \'wizard_element_browser\'"' - . ' to new "wizard_link", "' - . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'link\'][\'module\'][\'name\'] = \'wizard_link\'"'; - } - } - } - return $tca; - } - /** * Migrate defaultExtras "richtext:rte_transform[mode=ts_css]" and similar stuff like * "richtext:rte_transform[mode=ts_css]" to "richtext:rte_transform" @@ -2394,7 +1802,7 @@ class TcaMigration * @param array $tca * @return array */ - protected function migrateinputDateTimeMax(array $tca): array + protected function migrateInputDateTimeMax(array $tca): array { foreach ($tca as $table => &$tableDefinition) { if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {