Skip to content

Commit

Permalink
[TASK] TCA for sys_category images
Browse files Browse the repository at this point in the history
  • Loading branch information
georgringer committed Apr 15, 2024
1 parent 523ae3e commit 227886b
Showing 1 changed file with 13 additions and 46 deletions.
59 changes: 13 additions & 46 deletions Configuration/TCA/Overrides/sys_category.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 227886b

Please sign in to comment.