Create new page type 

Deprecated since version 14.3

This example demonstrates how to add a new page type (doktype) called "Archive". Starting with TYPO3 v14, registration is streamlined by centralizing the configuration in the TCA.

1. Configure the page type in TCA 

To define the behavior and appearance of the new page type, create or edit Configuration/TCA/Overrides/pages.php.

Inherit configuration 

A custom page type usually shares the same fields as a standard page. Copying the configuration from doktype 1 ensures that all default tabs and fields are available. This inheritance must happen first.

Define record restrictions 

The allowedRecordTypes key defines which database tables are allowed on this page type. Setting this to ['*'] allows all tables, while specifying tables such as ['tt_content'] restricts it to those tables.

Assign icon identifier 

The icon for the page tree and page properties is assigned via an icon identifier in the typeicon_classes array. This identifier must be registered later in the Icon API.

EXT:my_extension/Configuration/TCA/Overrides/pages.php
<?php

defined('TYPO3') or die();

use TYPO3\CMS\Core\Schema\Struct\SelectItem;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

(function () {
    $customPageDoktype = '116';
    $customIconClass = 'tx-examples-archive-page';

    $GLOBALS['TCA']['pages']['types'][$customPageDoktype] = $GLOBALS['TCA']['pages']['types'][1];
    $GLOBALS['TCA']['pages']['types'][$customPageDoktype]['allowedRecordTypes'] = ['*'];
    $GLOBALS['TCA']['pages']['ctrl']['typeicon_classes'][$customPageDoktype] = $customIconClass;

    ExtensionManagementUtility::addTcaSelectItem(
        'pages',
        'doktype',
        new SelectItem(
            'select',
            label: 'LLL:EXT:examples/Resources/Private/Language/locallang.xlf:archive_page_type',
            value: $customPageDoktype,
            icon: $customIconClass,
            group: 'special',
        ),
    );
})();
Copied!

2. Register the icon via Icon API 

The identifier used in the TCA (tx-examples-archive-page) must be registered in Configuration/Icons.php to link it to an SVG file.

EXT:my_extension/Configuration/Icons.php
<?php

use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider;

return [
    'tx-examples-archive-page' => [
        'provider' => SvgIconProvider::class,
        'source' => 'EXT:examples/Resources/Public/Images/ArchivePage.svg',
    ],
];
Copied!

You can also provide icons for special states by registering additional identifiers with specific suffixes:

  • Page is hidden in navigation: tx-examples-archive-page-hideinmenu
  • Page is a root page: tx-examples-archive-page-root
  • Page contains content from another page: tx-examples-archive-page-contentFromPid

3. Enable drag and drop in the page wizard 

To allow editors to create the new page type via the "New Page" wizard, add it to the doktypes list via user TSconfig.

EXT:my_extension/Configuration/user.tsconfig
options.pageTree.doktypesToShowInNewPageDragArea := addToList(116)
Copied!

4. Advanced: Dynamic configuration 

Instead of using a static TSconfig file, you can use the BeforeLoadedUserTsConfigEvent to add TSconfig dynamically through a PSR-14 event listener. This allows context-aware availability of page types.

Further information