0
votes

I have three type of content elements (tt_content|types) which all use an image-column with each one FAL-relations for one image.

I'd like to use for 2 content elements the type = 'imageManipulation' (Docs) with 2 different configurations and for one just the image as it is.

Since the type = 'imageManipulation' is defined normally for sys_file_reference, so for all usages.

Is it possible with TCA overrides to archive different configurations for different content elements?

I tried a combination of columnsOverrides and overrideChildTca, but this doesn't work in the moment:

<?php
defined('TYPO3_MODE') or die();

(function () {
    if (is_array($GLOBALS['TCA']['tt_content']['types']['mask_teaser_hero'])) {
        $GLOBALS['TCA']['tt_content']['types']['mask_teaser_hero']['columnsOverrides'] = [
            'tx_maskproject_teaserimage' => [
                'config' => [
                    'overrideChildTca' => [
                        'columns' => [
                            'crop' => [
                                'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.crop',
                                'config' => [
                                    'type' => 'imageManipulation',
                                    'cropVariants' => [
                                        'mobile' => [
                                            'title' => 'Mobile',
                                            'selectedRatio' => '4:3',
                                            'allowedAspectRatios' => [
                                                '4:3' => [
                                                    'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.4_3',
                                                    'value' => 4 / 3
                                                ],
                                            ],
                                        ],
                                        'desktop' => [
                                            'title' => 'Desktop',
                                            'selectedRatio' => '16:9',
                                            'allowedAspectRatios' => [
                                                '16:9' => [
                                                    'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.16_9',
                                                    'value' => 16 / 9
                                                ],
                                            ],
                                        ],
                                    ]
                                ],
                            ],
                        ]
                    ],
                ]
            ]
        ];
    }

})();

I first thought about Typoscript TCEFORM: https://metinyilmaz.de/artikel/typo3-image-cropvariants/

But this would also appear in each content element.

1
In your code you set the crop variant for CType mask_teaser_hero. Did you do the same for the other CTypes?Peter Kraume
This is exactly what I'd like to do. The CType mask_teaser_hero should use a different crop variant as the CType mask_teaser_x with the same column tx_maskproject_teaserimage.vaxul

1 Answers

1
votes

I found the mistake. The TCA override is correct. But the type was not.

I use EXT:mask_export for the content elements. In the example from the question I override the content elements which EXT:mask adds. But the exported content elements are different content elements.

The correct one is:

<?php
defined('TYPO3_MODE') or die();

(function () {
    if (is_array($GLOBALS['TCA']['tt_content']['types']['myextname_teaser_hero'])) {
        $GLOBALS['TCA']['tt_content']['types']['myextname_teaser_hero']['columnsOverrides'] = [
            'tx_myextname_teaserimage' => [
                'config' => [
                    'overrideChildTca' => [
                        'columns' => [
                            'crop' => [
                                'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.crop',
                                'config' => [
                                    'type' => 'imageManipulation',
                                    'cropVariants' => [
                                        'mobile' => [
                                            'title' => 'Mobile',
                                            'selectedRatio' => '4:3',
                                            'allowedAspectRatios' => [
                                                '4:3' => [
                                                    'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.4_3',
                                                    'value' => 4 / 3
                                                ],
                                            ],
                                        ],
                                        'desktop' => [
                                            'title' => 'Desktop',
                                            'selectedRatio' => '16:9',
                                            'allowedAspectRatios' => [
                                                '16:9' => [
                                                    'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.16_9',
                                                    'value' => 16 / 9
                                                ],
                                            ],
                                        ],
                                    ]
                                ],
                            ],
                        ]
                    ],
                ]
            ]
        ];
    }

})();