Create new page type
Deprecated since version 14.3
The method
Page has been
deprecated in favor of the new TCA option.
See also: Deprecation: #108557 - TCA option allowedRecordTypes for Page Types.
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.
Table of contents
Note
The doktype value must be defined as a string, for example '116'.
TYPO3 v14 uses strict comparisons in the Page Wizard TypeScript components.
Using an integer may cause UI issues such as failed validation or form resets.
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 allowed key defines which database tables are allowed
on this page type. Setting this to ['*'] allows all tables, while
specifying tables such as ['tt_ 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_ array. This identifier must be registered
later in the Icon API.
<?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',
),
);
})();
2. Register the icon via Icon API
The identifier used in the TCA (tx-) must be
registered in Configuration/Icons.php to link it to an SVG file.
<?php
use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider;
return [
'tx-examples-archive-page' => [
'provider' => SvgIconProvider::class,
'source' => 'EXT:examples/Resources/Public/Images/ArchivePage.svg',
],
];
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- content From Pid
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.
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.