Bug #88650
closedCreate new Page Type and addToAllTCAtypes for newly created doktype doesn't work
0%
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 !
Updated by Christoph Schorr over 5 years ago
Hi,
please find Pull request to updated PageType code examples here:
https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/pull/554
Greetings
Christoph
Updated by Susanne Moog over 4 years ago
- Status changed from New to Closed
Documentation has been updated.