#105605addToAllTCAtypes() while restricting to custom DokType
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'];Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 4
-
Lukas Wittmann changed description <span data-processor="relativetime" data-value="2024-11-15T10:58:29+00:00" > 11/15/24, 10:58 </span>
-
Lukas Wittmann changed description <span data-processor="relativetime" data-value="2024-11-15T11:02:38+00:00" > 11/15/24, 11:02 </span>
-
Nikita Hovratov commented <span data-processor="relativetime" data-value="2024-11-18T09:39:00+00:00" > 11/18/24, 09:39 </span>
-
Nikita Hovratov commented and changed status
NewClosed <span data-processor="relativetime" data-value="2024-11-18T09:43:36+00:00" > 11/18/24, 09:43 </span>Created an issue in the documentation repo: https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/issues/5050
As this is not a Core bug, but missing documentation I’ll close this issue.
Looks like the documentation went missing since v12. In v11, it’s still documented to copy the default showitems from standard page: https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ApiOverview/PageTypes/CreateNewPageType.html