Search code examples
typo3typo3-tca

TYPO3: How to configure $GLOBALS['TCA']['tt_content']['types']


I have an extension with a content element. I want to display it in the content element wizard. For this, I created tt_content.php. The code in it looks like this:

$GLOBALS['TCA']['tt_content']['types']['extensionkey_contentelementname'] = array(
    'types' => [
        '0' => [
            'showitem' => '
            --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general, category, subject, message,
            --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access, personal
        ',
        ],
    ]
);

(I obviously replaced extensionkey_contentelementname with the real name)

This throws me an error when trying to create the content element:

No or invalid showitem definition in TCA table tt_content for type extensionkey_contentelementname

What did I do wrong?


Solution

  • You are adding two array levels too much. You are already in $GLOBALS['TCA']['tt_content']['types'], so the typesand 0 is not needed anymore.

    https://docs.typo3.org/typo3cms/extensions/fluid_styled_content/7.6/AddingYourOwnContentElements/Index.html#configuration-tca-overrides-tt-content-php