Created
May 4, 2015 20:47
-
-
Save cedricziel/83a51482ed092365f0ae to your computer and use it in GitHub Desktop.
Add a custom doktype to TYPO3 pages table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Custom Doktypes | |
| */ | |
| // Define a new doktype | |
| $customShortlinkDoktype = 120; | |
| $customPageIcon = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/Shortlink.png'; | |
| // Add the new doktype to the list of page types | |
| $GLOBALS['PAGES_TYPES'][$customShortlinkDoktype] = array( | |
| 'type' => 'sys', | |
| 'icon' => $customPageIcon, | |
| 'allowedTables' => '*' | |
| ); | |
| // Add the new doktype to the page type selector | |
| $GLOBALS['TCA']['pages']['columns']['doktype']['config']['items'][] = array( | |
| 'Shortlink', | |
| $customShortlinkDoktype, | |
| $customPageIcon | |
| ); | |
| // Also add the new doktype to the page language overlays type selector (so that translations can inherit the same type) | |
| $GLOBALS['TCA']['pages_language_overlay']['columns']['doktype']['config']['items'][] = array( | |
| 'Shortlink', | |
| $customShortlinkDoktype, | |
| $customPageIcon | |
| ); | |
| // Add the icon for the new doktype | |
| \TYPO3\CMS\Backend\Sprite\SpriteManager::addTcaTypeIcon('pages', $customShortlinkDoktype, $customPageIcon); | |
| // Add the new doktype to the list of types available from the new page menu at the top of the page tree | |
| \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig( | |
| 'options.pageTree.doktypesToShowInNewPageDragArea := addToList(' . $customShortlinkDoktype . ')' | |
| ); |
Any news on OwlAsh's question?
For such who also search in 8.7 or newer - see T3 documentation under https://docs.typo3.org/typo3cms/CoreApiReference/PageTypes/Index.html
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible do deactivate tabs like "Categories" for the doktype?