Skip to content

Commit

Permalink
[TASK] Remove TcaPreparation workaround
Browse files Browse the repository at this point in the history
Fixes: #145
  • Loading branch information
nhovratov committed Apr 9, 2024
1 parent 640855a commit d8f11ba
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ fields:
fields:
- identifier: image
type: File
allowed: common-image-types
- identifier: title
type: Text
- identifier: bodytext
Expand Down
3 changes: 1 addition & 2 deletions Classes/FieldType/FileFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

namespace TYPO3\CMS\ContentBlocks\FieldType;

use TYPO3\CMS\Core\Preparations\TcaPreparation;
use TYPO3\CMS\Core\Resource\AbstractFile;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand Down Expand Up @@ -80,7 +79,7 @@ public function getTca(): array
$tca = $this->toTca();
$config['type'] = self::getTcaType();
if ($this->allowed !== [] && $this->allowed !== '') {
$config['allowed'] = TcaPreparation::prepareFileExtensions($this->allowed);
$config['allowed'] = $this->allowed;
}
if ($this->disallowed !== [] && $this->disallowed !== '') {
$config['disallowed'] = $this->disallowed;
Expand Down
3 changes: 0 additions & 3 deletions Classes/Generator/TcaGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
use TYPO3\CMS\ContentBlocks\Schema\SimpleTcaSchemaFactory;
use TYPO3\CMS\ContentBlocks\Service\SystemExtensionAvailability;
use TYPO3\CMS\Core\Configuration\Event\AfterTcaCompilationEvent;
use TYPO3\CMS\Core\Preparations\TcaPreparation;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand Down Expand Up @@ -149,7 +148,6 @@ public function __construct(
protected readonly SimpleTcaSchemaFactory $simpleTcaSchemaFactory,
protected readonly EventDispatcherInterface $eventDispatcher,
protected readonly LanguageFileRegistry $languageFileRegistry,
protected readonly TcaPreparation $tcaPreparation,
protected readonly SystemExtensionAvailability $systemExtensionAvailability,
protected readonly FlexFormGenerator $flexFormGenerator,
) {}
Expand Down Expand Up @@ -188,7 +186,6 @@ public function generate(array $baseTca): array
foreach ($this->tableDefinitionCollection as $tableDefinition) {
$tca[$tableDefinition->getTable()] = $this->generateTableTca($tableDefinition, $baseTca);
}
$tca = $this->tcaPreparation->prepare($tca);
return $tca;
}

Expand Down
18 changes: 1 addition & 17 deletions Tests/Unit/FieldTypes/FileFieldTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static function getTcaReturnsExpectedTcaDataProvider(): iterable
'exclude' => true,
'config' => [
'type' => 'file',
'allowed' => 'gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai,svg',
'allowed' => 'common-image-types',
'disallowed' => 'png',
'appearance' => [
'foo' => 'bar',
Expand Down Expand Up @@ -194,22 +194,6 @@ public static function getTcaReturnsExpectedTcaDataProvider(): iterable
],
],
];

yield 'allowed and disallowed accept arrays' => [
'config' => [
'non_available_field' => 'foo',
'allowed' => ['common-image-types'],
'disallowed' => ['png'],
],
'expectedTca' => [
'exclude' => true,
'config' => [
'type' => 'file',
'allowed' => 'gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai,svg',
'disallowed' => ['png'],
],
],
];
}

#[DataProvider('getTcaReturnsExpectedTcaDataProvider')]
Expand Down
42 changes: 0 additions & 42 deletions Tests/Unit/Generator/TcaGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
use TYPO3\CMS\Core\Cache\Frontend\NullFrontend;
use TYPO3\CMS\Core\EventDispatcher\NoopEventDispatcher;
use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider;
use TYPO3\CMS\Core\Preparations\TcaPreparation;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;

final class TcaGeneratorTest extends UnitTestCase
Expand Down Expand Up @@ -472,35 +471,13 @@ public static function checkTcaFieldTypesDataProvider(): iterable
'label' => 'file',
'config' => [
'type' => 'file',
'foreign_table' => 'sys_file_reference',
'foreign_field' => 'uid_foreign',
'foreign_sortby' => 'sorting_foreign',
'foreign_table_field' => 'tablenames',
'foreign_match_fields' => [
'fieldname' => 't3ce_example_file',
'tablenames' => 'tt_content',
],
'foreign_label' => 'uid_local',
'foreign_selector' => 'uid_local',
],
'exclude' => true,
],
't3ce_example_category' => [
'label' => 'category',
'config' => [
'type' => 'category',
'foreign_table' => 'sys_category',
'size' => 20,
'foreign_table_where' => ' AND {#sys_category}.{#sys_language_uid} IN (-1, 0)',
'relationship' => 'manyToMany',
'maxitems' => 99999,
'default' => 0,
'MM' => 'sys_category_record_mm',
'MM_opposite_field' => 'items',
'MM_match_fields' => [
'tablenames' => 'tt_content',
'fieldname' => 't3ce_example_category',
],
],
'exclude' => true,
],
Expand Down Expand Up @@ -957,19 +934,6 @@ public static function checkTcaFieldTypesDataProvider(): iterable
],
],
],
'sys_category' => [
'columns' => [
'items' => [
'config' => [
'MM_oppositeUsage' => [
'tt_content' => [
't3ce_example_category',
],
],
],
],
],
],
],
];

Expand Down Expand Up @@ -2144,7 +2108,6 @@ public function checkTcaFieldTypes(array $contentBlocks, array $expected): void
$simpleTcaSchemaFactory,
new NoopEventDispatcher(),
$languageFileRegistry,
new TcaPreparation(),
$systemExtensionAvailability,
$flexFormGenerator,
);
Expand Down Expand Up @@ -2329,7 +2292,6 @@ public function pageTypesGenerateCorrectTca(array $contentBlocks, bool $seoExten
$simpleTcaSchemaFactory,
new NoopEventDispatcher(),
$languageFileRegistry,
new TcaPreparation(),
$systemExtensionAvailability,
$flexFormGenerator,
);
Expand Down Expand Up @@ -2371,7 +2333,6 @@ public function missingLabelFieldThrowsException(): void
$simpleTcaSchemaFactory,
new NoopEventDispatcher(),
$languageFileRegistry,
new TcaPreparation(),
$systemExtensionAvailability,
$flexFormGenerator,
);
Expand Down Expand Up @@ -3039,7 +3000,6 @@ public function checkFlexFormTca(array $contentBlocks, array $expected): void
$simpleTcaSchemaFactory,
new NoopEventDispatcher(),
$languageFileRegistry,
new TcaPreparation(),
$systemExtensionAvailability,
$flexFormGenerator,
);
Expand Down Expand Up @@ -3093,7 +3053,6 @@ public function displayCondIsPrefixedForStringSyntax(): void
$simpleTcaSchemaFactory,
new NoopEventDispatcher(),
$languageFileRegistry,
new TcaPreparation(),
$systemExtensionAvailability,
$flexFormGenerator,
);
Expand Down Expand Up @@ -3318,7 +3277,6 @@ public function existingTablesCanBeExtendedWithAdditionalType(): void
$simpleTcaSchemaFactory,
new NoopEventDispatcher(),
$languageFileRegistry,
new TcaPreparation(),
$systemExtensionAvailability,
$flexFormGenerator,
);
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
},
"require": {
"symfony/var-exporter": "^6.4 || ^7.0",
"typo3/cms-backend": "^12.4.11",
"typo3/cms-core": "^12.4.11",
"typo3/cms-fluid": "^12.4.11",
"typo3/cms-frontend": "^12.4.11"
"typo3/cms-backend": "^12.4.14",
"typo3/cms-core": "^12.4.14",
"typo3/cms-fluid": "^12.4.14",
"typo3/cms-frontend": "^12.4.14"
},
"replace": {
"typo3/cms-content-blocks": "*"
Expand Down

0 comments on commit d8f11ba

Please sign in to comment.