mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-25 07:56:13 +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
### Changed
- Make the TCA ready for TYPO3 v12 (#625)
- Upgrade to PHPUnit 9 and PHPCOV 8 (#610)
- Convert functional test fixtures to CSV (#601)
- Use typed properties instead of `@var` annotations (#599, #612, #628)

View file

@ -1,12 +1,11 @@
<?php
return [
$tca = [
'ctrl' => [
'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea',
'label' => 'title',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'delete' => 'deleted',
'default_sortby' => 'title',
'iconfile' => 'EXT:tea/Resources/Public/Icons/Record.svg',
@ -22,7 +21,8 @@ return [
'type' => 'input',
'size' => 40,
'max' => 255,
'eval' => 'trim,required',
'eval' => 'trim',
'required' => true,
],
],
'description' => [
@ -38,19 +38,55 @@ return [
],
'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,
],
'config' => [
'type' => 'file',
'maxitems' => 1,
'appearance' => [
'collapseAll' => true,
'useSortable' => false,
'enabledControls' => [
'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;