<?php
if (!defined('TYPO3')) {
	die ('Access denied.');
}

// Register new page type "Reference Page"
$referencePageType = 100;

\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\PageDoktypeRegistry::class)->add($referencePageType, [
    'type' => 'web',
    'allowedTables' => '*',
]);

\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class)
    ->registerIcon(
        'apps-pagetree-referencePage',
        TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
        [
            'source' => 'EXT:energize/Resources/Public/Icons/Content/content-panel.svg',
        ]
    );

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(
    'options.pageTree.doktypesToShowInNewPageDragArea := addToList(' . $referencePageType . ')'
);
