TCA override on showItem when sys_language_uid != 0

326 views Asked by At

I'm updating a TYPO3 v8.7 to TYPO3 10.4 LTS

In the TCA we have a pageType with a showitem of our choice. In v8 we used the following to have a custom view for a translated page eg. pages_language_overlay

$GLOBALS['TCA']['pages_language_overlay']['types'][$doktype] = array_replace_recursive(
    $GLOBALS['TCA']['pages_language_overlay']['types'][$doktype],
    [
        'showitem' => '
                         myCustomShowItemString
                '
    ]
);

Question: What would be the correct way to get have this behaviour again since pages_language_overlay does not exist anymore?

2

There are 2 answers

0
Joey Bouten On BEST ANSWER

TCA - file which has to be loaded after custom fields

$disableOnLanguageOverlay = [
    'my_tca_field',
    'my_tca_field',
];

foreach ($disableOnLanguageOverlay as $field) {
    if (isset($GLOBALS['TCA']['pages']['columns'][$field])) {
        $GLOBALS['TCA']['pages']['columns'][$field] = array_merge($GLOBALS['TCA']['pages']['columns'][$field], ['l10n_mode' => 'exclude']);
    }
}

And for Typoscript

[siteLanguage("languageId") != 0]
    TCEFORM {
        pages {
            myField {
                disabled = 0
            }
        }
    }
[global]

Solved above

0
Bernd Wilke πφ On

as the translated pagesrecords also are pages records you need this configuration for the table pages.

either you have it already, as your new doktype behaves the same for each language

or you need a special handling if sys_language_uid is not 0.
Then you probably need display conditions for those fields which behave different depending on sys_language_uid (this one visible, others invisible?)