#88650Create new Page Type and addToAllTCAtypes for newly created doktype doesn't work
Description
Create a new page type as describe in Typo3 documentation :
[[https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/PageTypes/Index.html]]
And then make fields available in a new tab for newly created doktype only :
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'pages',
'--div--;LLL:EXT:Myext/Resources/Private/Language/locallang_db.xlf:pages.tab.newDoktype,tx_myext_col1,tx_myext_col1',
// Add only to the new doktype
\Vendor\MyExt\Domain\Repository\PageRepository::NEW_DOKTYPE
);
The result is that the new tab with columns is not displayed for the new doktype, if the doktype is omitted in ‘addToAllTCAtypes’, all works fine.
The problem is because there’s no ‘showitem’ TCA section for the new doktype.
A workaround is to duplicate the standard page ‘showitem’ section, in Configuration/TCA/Overrides/pages.php, add :
// Add icon for new page type:
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule(
$GLOBALS['TCA']['pages'],
[
'ctrl' => [
'typeicon_classes' => [
$archiveDoktype => 'apps-pagetree-archive',
],
],
'types' => [
(string) Vendor\MyExt\Domain\Repository\PageRepository::NEW_DOKTYPE => [
'showitem' => $GLOBALS['TCA']['pages']['types'][\TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_DEFAULT]['showitem']
]
]
]
);
Maybe it’s just an update of the documentation !
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.