Create new Page Type
The following example adds a new page type called "Archive".

The new page type visible in the TYPO3 backend
Changes need to be made in several files to create a new page type. Follow the directions below to the end:
Changed in version 12.0
A new
Page
was introduced replacing the
$GLOBALS
array. Use the version selector to look up
the syntax in the corresponding documentation version for older
TYPO3 versions.
-
Add new page type to
Page
Doktype Registry The new page type has to be added to the
\TYPO3\
. TYPO3 uses this registry internally to only allow specific tables to be inserted on that page type. This registry will not add or modify any TCA. In example below all kind of tables (CMS\ Core\ Data Handling\ Page Doktype Registry *
) are allowed to be inserted on the new page type.The new page type is added to the
Page
inDoktype Registry ext_tables.php
:EXT:examples/ext_tables.php<?php use TYPO3\CMS\Core\DataHandling\PageDoktypeRegistry; use TYPO3\CMS\Core\Utility\GeneralUtility; defined('TYPO3') or die(); // Define a new doktype $customPageDoktype = 116; // Add page type to system $dokTypeRegistry = GeneralUtility::makeInstance(PageDoktypeRegistry::class); $dokTypeRegistry->add( $customPageDoktype, [ 'allowedTables' => '*', ], );
-
Add an icon chosen for the new page type
You need to add the icon chosen for the new page type and allow users to drag and drop the new page type to the page tree.
We need to add the following user TSconfig to all users, so that the new page type is displayed in the wizard:
EXT:examples/Configuration/TsConfig/User/UserConfiguration.tsconfigYou can load the file like this:
EXT:examples/ext_localconf.php<?php use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; defined('TYPO3') or die(); // Add custom doktype to the page tree toolbar ExtensionManagementUtility::addUserTSConfig( "@import 'EXT:examples/Configuration/TsConfig/User/*.tsconfig'", );
The icon is registered in
Configuration/Icons.php
:EXT:examples/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', ], ];
It is possible to define additional type icons for special case pages:
- Page contains content from another page
<doktype>-
, For example:content From Pid $GLOBALS
.['TCA'] ['pages'] ['ctrl'] ['typeicon_ classes'] ['116- content From Pid'] - Page is hidden in navigation
<doktype>-
For example:hideinmenu $GLOBALS
.['TCA'] ['pages'] ['ctrl'] ['typeicon_ classes'] ['116- hideinmenu'] - Page is the root of the site
<doktype>-
For example:root $GLOBALS
.['TCA'] ['pages'] ['ctrl'] ['typeicon_ classes'] ['116- root']
Note
Make sure to add the additional icons using the Icon API!
- Page contains content from another page
-
Add new page type to doktype selector
We need to modify the configuration of page records. As one can modify the pages, we need to add the new doktype as a select option and associate it with the configured icon. That is done in
Configuration/TCA/Overrides/pages.php
:EXT:examples/Configuration/TCA/Overrides/pages.php<?php defined('TYPO3') or die(); // encapsulate all locally defined variables (function () { // SAME as registered in ext_tables.php $customPageDoktype = 116; $customIconClass = 'tx-examples-archive-page'; // Add the new doktype to the page type selector \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem( 'pages', 'doktype', [ 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang.xlf:archive_page_type', 'value' => $customPageDoktype, 'icon' => $customIconClass, 'group' => 'special', ], ); // Add the icon to the icon class configuration $GLOBALS['TCA']['pages']['ctrl']['typeicon_classes'][$customPageDoktype] = $customIconClass; })();
As you can see from the example, to make sure you get the correct icons, you can utilize
typeicon_
.classes -
Define your own columns for new page type
By default the new page type will render all columns of default page type (
DEFAULT
). If you want to chose your own columns you have to copy over all columns from default page type:(1) EXT:examples/Configuration/TCA/Overrides/pages.php<?php defined('TYPO3') or die(); // encapsulate all locally defined variables (function () { // ...code from previous example // Copy over all columns from default page type to allow TCA modifications // with f.e. ExtensionManagementUtility::addToAllTCAtypes() $GLOBALS['TCA']['pages']['types'][116] = $GLOBALS['TCA']['pages']['types'][1]; })();
Now you can modify TCA with Core API like
Extension
Management Utility:: add To All TCAtypes ();