Bug #88650

Create new Page Type and addToAllTCAtypes for newly created doktype doesn't work

Added by Florian Rival over 1 year ago. Updated 8 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2019-06-28
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
CodingNight
Complexity:
Is Regression:
Sprint Focus:

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 !

History

#1 Updated by Susanne Moog about 1 year ago

  • Tags set to CodingNight

#2 Updated by Christoph Schorr about 1 year ago

Hi,

please find Pull request to updated PageType code examples here:
https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/pull/554

Greetings
Christoph

#3 Updated by Susanne Moog 8 months ago

  • Status changed from New to Closed

Documentation has been updated.

Also available in: Atom PDF