Reputation: 99
I try to add a palette to the tt_content table under the existing tab 'General'. Here my tt_conten.php file.
<?php
defined('TYPO3_MODE') or die();
// Feld definieren
$tempColumns = [
'tx_imagetext_color' => [
'label' => 'color',
'exclude' => 0,
'config' => [
'type' => 'input',
'eval' => 'trim',
]
],
'tx_imagetext_image' => [
'label' => 'image',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'special' => 'languages',
'items' => [
[
'LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages',
-1,
'flags-multiple'
]
],
'default' => 0,
],
]
];
// Feld der allgemeinen Datensatzbeschreibung hinzufügen - noch keine Ausgabe im Backend!
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $tempColumns);
// Feld einer neuen Palette hinzufügen
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette(
'tt_content',
'imagetext',
'tx_imagetext_color, tx_imagetext_image'
);
// Neue Palette dem Tag hinzufügen, nach dem Titel - Dadurch Anzeige im Backend
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'tt_content',
'--div--;general,
--palette--;;imagetext',
'',
''
);
Typo3 creates a new general on the end with the right palette. But I want that the palette should appear in the already existing tab General.
How can I achive that?
Upvotes: 0
Views: 5644
Reputation: 769
--div--;general
explicitly creates a new tab with the name "general".
If you only want your new palette to appear right after some other field in the "general" tab you only need to specify that field as the last argument of addToAllTCAtype function. As you wrote "nach dem Titel" I assume you want it appear right after the header field. The following works for me in TYPO3 10 but I think it should be the same in v. 9.5.xx
// Neue Palette hinzufügen, nach dem Titel - Dadurch Anzeige im Backend
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'tt_content',
'--palette--;;imagetext',
'',
'after:header'
);
A little more explanation
addToAllTCAtypes
takes four arguments:
Upvotes: 3