From 227886b4413eda4024259bac244e41c7367b9511 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Mon, 15 Apr 2024 20:41:36 +0200 Subject: [PATCH] [TASK] TCA for sys_category images --- Configuration/TCA/Overrides/sys_category.php | 59 +++++--------------- 1 file changed, 13 insertions(+), 46 deletions(-) diff --git a/Configuration/TCA/Overrides/sys_category.php b/Configuration/TCA/Overrides/sys_category.php index 5d4a8e8f6f..4494564410 100644 --- a/Configuration/TCA/Overrides/sys_category.php +++ b/Configuration/TCA/Overrides/sys_category.php @@ -5,51 +5,6 @@ $ll = 'LLL:EXT:news/Resources/Private/Language/locallang_db.xlf:'; $configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\GeorgRinger\News\Domain\Model\Dto\EmConfiguration::class); -$imageSettings = [ - 'behaviour' => [ - 'allowLanguageSynchronization' => true, - ], - 'overrideChildTca' => [ - 'types' => [ - '0' => [ - 'showitem' => '--palette--;;imageoverlayPalette, --palette--;;filePalette', - ], - \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ - 'showitem' => '--palette--;;imageoverlayPalette, --palette--;;filePalette', - ], - ], - ], - 'appearance' => [ - 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference', - 'showPossibleLocalizationRecords' => true, - 'showAllLocalizationLink' => true, - 'showSynchronizationLink' => true, - ], - 'foreign_match_fields' => [ - 'fieldname' => 'images', - 'tablenames' => 'sys_category', - 'table_local' => 'sys_file', - ], -]; - -$versionInformation = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Information\Typo3Version::class); -if ($versionInformation->getMajorVersion() > 11) { - $imageConfiguration = [ - 'type' => 'file', - 'appearance' => $imageSettings['appearance'], - 'behaviour' => $imageSettings['behaviour'], - 'allowed' => 'common-image-types', - ]; -} else { - /** @noinspection PhpDeprecationInspection */ - // @extensionScannerIgnoreLine - $imageConfiguration = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( - 'image', - $imageSettings, - $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] - ); -} - /** * Add extra fields to the sys_category record */ @@ -81,7 +36,19 @@ 'images' => [ 'exclude' => true, 'label' => $ll . 'tx_news_domain_model_category.image', - 'config' => $imageConfiguration, + 'config' => [ + 'type' => 'file', + 'appearance' => [ + 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference', + 'showPossibleLocalizationRecords' => true, + 'showAllLocalizationLink' => true, + 'showSynchronizationLink' => true, + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true, + ], + 'allowed' => 'common-image-types', + ], ], 'single_pid' => [ 'exclude' => true,