Skip to content
Advertisement

TCA override on showItem when sys_language_uid != 0

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?

Advertisement

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

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement