From bc7c43613c81fe82c334131187c172b5559270a3 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Fri, 7 Oct 2022 18:54:40 +0200 Subject: [PATCH] [TASK] Use correct image configuration for v12 --- Configuration/TCA/tt_address.php | 86 +++++++++++++++++--------------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/Configuration/TCA/tt_address.php b/Configuration/TCA/tt_address.php index 5b00a9c1..fdfd443f 100755 --- a/Configuration/TCA/tt_address.php +++ b/Configuration/TCA/tt_address.php @@ -1,59 +1,63 @@ getMajorVersion() > 11) { - $imageConfiguration = [ - 'type' => 'file', - 'maxItems' => 6, - 'allowed' => \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], true), - ]; -} else { - $imageConfiguration = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( - 'image', - [ - 'maxitems' => 6, - 'minitems' => 0, - 'appearance' => [ - 'collapseAll' => true, - 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference' - ], - 'behaviour' => [ - 'allowLanguageSynchronization' => true, - ], - 'overrideChildTca' => [ - 'types' => [ - '0' => [ - 'showitem' => ' +$imageSettings = [ + 'maxitems' => 6, + 'minitems' => 0, + 'appearance' => [ + 'collapseAll' => true, + 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference' + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true, + ], + 'overrideChildTca' => [ + 'types' => [ + '0' => [ + 'showitem' => ' --palette--;' . 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' - ], - \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [ - 'showitem' => ' + ], + \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [ + 'showitem' => ' --palette--;' . 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' - ], - \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ - 'showitem' => ' + ], + \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ + 'showitem' => ' --palette--;' . 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' - ], - \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [ - 'showitem' => ' + ], + \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [ + 'showitem' => ' --palette--;' . 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' - ], - \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [ - 'showitem' => ' + ], + \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [ + 'showitem' => ' --palette--;' . 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' - ], - \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [ - 'showitem' => ' + ], + \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [ + 'showitem' => ' --palette--;' . 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' - ], - ], ], ], + ], +]; +$versionInformation = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Information\Typo3Version::class); +if ($versionInformation->getMajorVersion() > 11) { + $imageConfiguration = [ + 'type' => 'file', + 'maxItems' => 6, + 'appearance' => $imageSettings['appearance'], + 'behaviour' => $imageSettings['behaviour'], + 'overrideChildTca' => $imageSettings['overrideChildTca'], + 'allowed' => \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], true), + ]; +} else { + $imageConfiguration = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( + 'image', + $imageSettings, $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] ); }