Boris Weisgerber
Boris Weisgerber

Reputation: 11

TYPO3 TCA pages types add Tab

I want to add an existing tab to special pagetype. For example tab "social media" to pagetype 254 (folder). So i used mergeRecursiveWithOverrule like this, but then i redefine all. Can i only add a single tab?

\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule(
    $GLOBALS['TCA']['pages'],
    [
        'types' => [
            254 => [
                'showitem' => '
                    --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general, --palette--;;standard, --palette--;;titleonly, ,
                    --div--;LLL:EXT:seo/Resources/Private/Language/locallang_tca.xlf:pages.tabs.socialmedia, --palette--;;opengraph, --palette--;;twittercards,
,...
,
'
            ]
        ],
    ],
);

Thanks

Upvotes: 0

Views: 1092

Answers (1)

Julian Hofmann
Julian Hofmann

Reputation: 2557

ExtensionManagementUtility::addToAllTCAtypes() is what you are looking for, especially the third parameter.

Parameters of addToAllTCAtypes():

  1. Name of the table to which the fields should be added.

  2. Comma-separated string of fields, the same syntax used in the showitem property of types in TCA.

  3. Optional: record types of the table where the fields should be added, see types in TCA for details.

  4. Optional: position ('before' or 'after') in relation to an existing field.

Docs: Extension Development -> Extending the TCA array -> Customization Examples

Upvotes: 1

Related Questions