Actions
Bug #105605
closedaddToAllTCAtypes() while restricting to custom DokType
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2024-11-15
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
Hello TYPO3 Team,
I build a new dokType in my ext_tables.php. I registered it in my TCA/Overrides/pages.php and wanted to add a new palette to my general tab like shown in the following code example:
ext_tables.php:
// Define a new doktype
$customPageDoktype = 198;
// Add page type to system
$dokTypeRegistry = GeneralUtility::makeInstance(PageDoktypeRegistry::class);
$dokTypeRegistry->add(
$customPageDoktype,
[
'allowedTables' => '*',
],
);
Configuration/TCA/Overrides/pages.php:
// Add the new doktype to the page type selector
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
'pages',
'doktype',
[
'label' => 'label',
'value' => '198',
'group' => 'Journal',
],
'198',
'after'
);
$tempColumns = [
'testField' => [
'label' => 'journal',
'config' => [
'type' => 'input',
]
]
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'pages',
$tempColumns
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette(
'pages',
'testPalette',
'testField'
);
// did not work
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'pages',
'--palette--;' . $label . ';testPalette',
'198',
'before:title'
);
Problem:
The addToAllTCAtypes() function didn't work out as expected and did not add it in my BE.
If I removed the 198 dokType it worked for all dokType.
Solution:
After adding the following line infront of the addToAllTCAtypes() call it fixed my problem:
Configuration/TCA/Overrides/pages.php:
$GLOBALS['TCA']['pages']['types']['198'] = $GLOBALS['TCA']['pages']['types']['1'];
Actions