Search code examples
typo3typoscripttypo3-7.6.xtypo3-8.xtypo3-extensions

TYPO3: re-define altLabels in TCEFORM for layout with multisite


I use EXT:T3sBootstrap and define comprehensible voices for the layouts the editors may select ... this works fine with the following code:

ext_localconf.php :

# Set TCEFORM features 
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:myExt/Configuration/PageTSConfig/TCEForm.ts">');

Configuration/PageTSConfig/TCEForm.ts :

TCEFORM {
    tt_content {
        layout {
            addItems {
                4 = special box
                100 = extra
            }
            altLabels {
                0 = Default
                1 = image shadow
                2 = line shadow
                3 = line shadow inv
            }
            disableNoMatchingValueElement = 1
        }
    }
}

in my second site I want to be able to re-define these labels with comprehensible voices but, although the static template of the first site is not included, it takes this configuration and does not use the one I just defined in the new myExt ...


Solution

  • (Page) TSconfig is loaded independent from the TypoScript static templates. The way you currently load the TSconfig into TYPO3, it will be used for all websites in this TYPO3 instance. So, the TSconfig from your second site is simply overwritten by your first configuration shown above.

    Since TYPO3 v7, you can use registerPageTSConfigFile to add TSconfig settings as needed into your different page trees and websites:

    your_extension/Configuration/TCA/Overrides/pages.php

    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerPageTSConfigFile(
        'your_extension',
        'Configuration/PageTSConfig/TCEForm.ts',
        'My TCEform config including custom altLabels'
    );
    

    This enables you to select the TSconfig in the page properties, where it will apply for all subpages.

    You can find a working example here.