mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-25 12:16:14 +01:00

[TASK] Make the TCA ready for TYPO3 v12 (#625)

Co-authored-by: lina.wolf <lwolf@w-commerce.de>
This commit is contained in:
Lina Wolf 2022-10-12 11:10:13 +02:00 committed by GitHub
parent ee455e567b
commit a6d75b72f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 15 deletions

View file

@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
### Added ### Added
### Changed ### Changed
- Make the TCA ready for TYPO3 v12 (#625)
- Upgrade to PHPUnit 9 and PHPCOV 8 (#610) - Upgrade to PHPUnit 9 and PHPCOV 8 (#610)
- Convert functional test fixtures to CSV (#601) - Convert functional test fixtures to CSV (#601)
- Use typed properties instead of `@var` annotations (#599, #612, #628) - Use typed properties instead of `@var` annotations (#599, #612, #628)

View file

@ -1,12 +1,11 @@
<?php <?php
return [ $tca = [
'ctrl' => [ 'ctrl' => [
'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea', 'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea',
'label' => 'title', 'label' => 'title',
'tstamp' => 'tstamp', 'tstamp' => 'tstamp',
'crdate' => 'crdate', 'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'delete' => 'deleted', 'delete' => 'deleted',
'default_sortby' => 'title', 'default_sortby' => 'title',
'iconfile' => 'EXT:tea/Resources/Public/Icons/Record.svg', 'iconfile' => 'EXT:tea/Resources/Public/Icons/Record.svg',
@ -22,7 +21,8 @@ return [
'type' => 'input', 'type' => 'input',
'size' => 40, 'size' => 40,
'max' => 255, 'max' => 255,
'eval' => 'trim,required', 'eval' => 'trim',
'required' => true,
], ],
], ],
'description' => [ 'description' => [
@ -38,19 +38,55 @@ return [
], ],
'image' => [ 'image' => [
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.image', 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( 'config' => [
'image', 'type' => 'file',
[ 'maxitems' => 1,
'maxitems' => 1, 'appearance' => [
'appearance' => [ 'collapseAll' => true,
'collapseAll' => true, 'useSortable' => false,
'useSortable' => false, 'enabledControls' => [
'enabledControls' => [ 'hide' => false,
'hide' => false,
],
], ],
] ],
), 'allowed' => 'common-image-types',
],
], ],
], ],
]; ];
$typo3Version = new \TYPO3\CMS\Core\Information\Typo3Version();
if ($typo3Version->getMajorVersion() < 12) {
$tca = array_replace_recursive(
$tca,
[
'ctrl' => [
'cruser_id' => 'cruser_id',
],
'columns' => [
'title' => [
'config' => [
'eval' => 'trim,required',
],
],
],
]
);
unset($tca['columns']['title']['required']);
$tca['columns']['image'] = [
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'image',
[
'maxitems' => 1,
'appearance' => [
'collapseAll' => true,
'useSortable' => false,
'enabledControls' => [
'hide' => false,
],
],
]
),
];
}
return $tca;