Skip to content

Instantly share code, notes, and snippets.

@wowaTYPO3
Created July 21, 2025 07:20
Show Gist options
  • Save wowaTYPO3/3ab53a4b2279cb1a64d4d304e448ad7d to your computer and use it in GitHub Desktop.
Save wowaTYPO3/3ab53a4b2279cb1a64d4d304e448ad7d to your computer and use it in GitHub Desktop.
TCA/Overrides/tt_content.php
<?php
defined('TYPO3') or die();
// https://docs.typo3.org/m/typo3/reference-tca/main/en-us/Index.html
// Adds additional fields to tt_content
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', [
'seasonalcontentcontrol' => [
'exclude' => true,
'label' => 'LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.seasonalcontentcontrol',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.seasonalcontentcontrol.always', 'always'],
['LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.seasonalcontentcontrol.summer', 'summer'],
['LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.seasonalcontentcontrol.winter', 'winter'],
],
'default' => 'always',
],
],
]);
// Adds background color selection field to tt_content
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', [
'background_color' => [
'exclude' => true,
'displayCond' => 'FIELD:frame_class:!=:none',
'label' => 'LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.background_color',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.background_color.none', 'none'],
['LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.background_color.primay', 'primary'],
['LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.background_color.secondary', 'secondary'],
['LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.background_color.tertiary', 'tertiary'],
['LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.background_color.quaternary', 'quaternary'],
['LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.background_color.dark', 'dark'],
['LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.background_color.light', 'light'],
],
'default' => 'none',
],
],
]);
// Adds image field to tt_content
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', [
'background_image' => [
'exclude' => true,
'displayCond' => 'FIELD:frame_class:!=:none',
'label' => 'LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.background_image',
'config' => [
'type' => 'file',
'maxitems' => 1,
'allowed' => 'common-image-types'
],
'l10n_mode' => 'exclude',
],
]);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', [
'parallax' => [
'exclude' => true,
'displayCond' => 'FIELD:frame_class:!=:none',
'label' => 'LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.parallax',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'items' => [
[
0 => '',
1 => '',
]
],
'default' => 0,
],
],
]);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', [
'typewriter' => [
'exclude' => true,
'label' => 'LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.typewriter',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'items' => [
[
0 => '',
1 => '',
]
],
'default' => 0,
],
],
]);
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', [
'section_title' => [
'exclude' => true,
'label' => 'Section title',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'items' => [
[
0 => '',
1 => '',
]
],
'default' => 0,
],
],
]);
// Adds the field to the existing palette
$GLOBALS['TCA']['tt_content']['palettes']['headers']['showitem'] .= ', --linebreak--, section_title, --linebreak--, typewriter';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', [
'display_control' => [
'exclude' => true,
'label' => 'LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.display_control',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.display_control.all', 'all'],
['LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.display_control.mobile', 'mobile'],
['LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.display_control.desktop', 'desktop'],
],
'default' => 'all',
],
],
]);
// Adds the fields to the existing palette
$GLOBALS['TCA']['tt_content']['palettes']['frames']['showitem'] .= ', --linebreak--, seasonalcontentcontrol, display_control, --linebreak--, background_color, --linebreak--, background_image, --linebreak--, parallax';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', [
'headersize' => [
'exclude' => true,
'label' => 'Header size',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['Default', 'default'],
['L', 'l'],
['XL', 'xl'],
['XXL', 'xxl'],
['XXXL', 'xxxl'],
['XXXXL', 'xxxxl'],
],
'default' => 'default',
],
],
]);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette(
'tt_content',
'headers',
'headersize',
'after:header_layout'
);
$aosColumns = [
'aos_fade_animation' => [
'exclude' => 1,
'label' => 'Fade Animation',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'default' => 'fade-up',
'items' => [
[
'label' => 'None',
'value' => '0',
],
[
'label' => 'Fade animations',
'value' => '--div--',
],
[
'label' => 'fade',
'value' => 'fade',
],
[
'label' => 'fade-up',
'value' => 'fade-up',
],
[
'label' => 'fade-down',
'value' => 'fade-down',
],
[
'label' => 'fade-left',
'value' => 'fade-left',
],
[
'label' => 'fade-right',
'value' => 'fade-right',
],
[
'label' => 'fade-up-right',
'value' => 'fade-up-right',
],
[
'label' => 'fade-up-left',
'value' => 'fade-up-left',
],
[
'label' => 'fade-down-right',
'value' => 'fade-down-right',
],
[
'label' => 'fade-down-left',
'value' => 'fade-down-left',
],
[
'label' => 'Flip animations',
'value' => '--div--',
],
[
'label' => 'flip-up',
'value' => 'flip-up',
],
[
'label' => 'flip-down',
'value' => 'flip-down',
],
[
'label' => 'flip-left',
'value' => 'flip-left',
],
[
'label' => 'flip-right',
'value' => 'flip-right',
],
[
'label' => 'Slide animations',
'value' => '--div--',
],
[
'label' => 'slide-up',
'value' => 'slide-up',
],
[
'label' => 'slide-down',
'value' => 'slide-down',
],
[
'label' => 'slide-left',
'value' => 'slide-left',
],
[
'label' => 'slide-right',
'value' => 'slide-right',
],
[
'label' => 'Zoom animations',
'value' => '--div--',
],
[
'label' => 'zoom-in',
'value' => 'zoom-in',
],
[
'label' => 'zoom-in-up',
'value' => 'zoom-in-up',
],
[
'label' => 'zoom-in-down',
'value' => 'zoom-in-down',
],
[
'label' => 'zoom-in-left',
'value' => 'zoom-in-left',
],
[
'label' => 'zoom-in-right',
'value' => 'zoom-in-right',
],
[
'label' => 'zoom-out',
'value' => 'zoom-out',
],
[
'label' => 'zoom-out-up',
'value' => 'zoom-out-up',
],
[
'label' => 'zoom-out-down',
'value' => 'zoom-out-down',
],
[
'label' => 'zoom-out-left',
'value' => 'zoom-out-left',
],
[
'label' => 'zoom-out-right',
'value' => 'zoom-out-right',
],
],
],
],
'aos_offset' => [
'exclude' => 1,
'label' => 'Offset',
'description' => 'offset (in px) from the original trigger point',
'config' => [
'type' => 'number',
'default' => '200',
'format' => 'integer',
],
],
'aos_delay' => [
'exclude' => 1,
'label' => 'Delay',
'description' => 'values from 0 to 3000, with step 50ms',
'config' => [
'type' => 'number',
'default' => '0',
'format' => 'integer',
'range' => [
'lower' => 0,
'upper' => 3000
],
],
],
'aos_duration' => [
'exclude' => 1,
'label' => 'Duration',
'description' => 'values from 0 to 3000, with step 50ms',
'config' => [
'type' => 'number',
'default' => '400',
'format' => 'integer',
'range' => [
'lower' => 0,
'upper' => 3000
],
],
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $aosColumns);
// Neuen Reiter und Feld zur Anzeige hinzufügen
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'tt_content',
'--div--;AOS Settings, aos_fade_animation, --linebreak--, aos_offset, --linebreak--, aos_delay, --linebreak--, aos_duration',
'',
'after:description'
);
call_user_func(function () {
// Neue Felder definieren
$newColumns = [
'show_more' => [
'exclude' => 1,
'label' => 'LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.show_more',
'onChange' => 'reload',
'config' => [
'type' => 'check',
'default' => 0,
],
],
'show_more_text' => [
'exclude' => 1,
'label' => 'LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.show_more_text',
'config' => [
'type' => 'input',
'size' => 20,
'eval' => 'trim',
'default' => 'Show more',
],
'displayCond' => 'FIELD:show_more:=:1',
],
'show_less_text' => [
'exclude' => 1,
'label' => 'LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.show_less_text',
'config' => [
'type' => 'input',
'size' => 20,
'eval' => 'trim',
'default' => 'Show less',
],
'displayCond' => 'FIELD:show_more:=:1',
],
'show_height' => [
'exclude' => 1,
'label' => 'LLL:EXT:cawdbase/Resources/Private/Language/locallang_db.xlf:tt_content.show_height',
'config' => [
'type' => 'input',
'size' => 4,
'eval' => 'int',
'default' => 300,
],
'displayCond' => 'FIELD:show_more:=:1',
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $newColumns);
// Felder dem Text-Element hinzufügen – direkt nach dem bodytext Feld
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'tt_content',
'show_more, show_more_text, show_less_text, show_height',
'text',
'after:bodytext'
);
});
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItemGroup(
'tt_content', // table
'CType', // typeField
'cta_marketing', // group
'CTA & Marketing', // label
'after:container', // position
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItemGroup(
'tt_content', // table
'CType', // typeField
'infos_contact', // group
'Infos & Contact', // label
'before:lists', // position
);
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItemGroup(
'tt_content', // table
'CType', // typeField
'design', // group
'Design & Layout', // label
'after:cta_marketing', // position
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment