Skip to content

Commit

Permalink
[TASK] prevent v12 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Achim Fritz committed Nov 10, 2023
1 parent 2c56ee6 commit 5dd27de
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions Configuration/TCA/Overrides/pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,42 @@
defined('TYPO3') or die();

use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

(function ($extensionKey = 'form_custom_templates', $table='pages') {
// Add page type
$emailDoktype = (string)GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('form_custom_templates', 'doktype');
ExtensionManagementUtility::addTcaSelectItem(
$table,
'doktype',
[
'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/Database:form_custom_templates.pageType',
$emailDoktype,
'apps-pagetree-page-email',
'special',
],
'254',
'before'
);

if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) {
ExtensionManagementUtility::addTcaSelectItem(
$table,
'doktype',
[
'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/Database:form_custom_templates.pageType',
$emailDoktype,
'apps-pagetree-page-email',
'special',
],
'254',
'before'
);
} else {
ExtensionManagementUtility::addTcaSelectItem(
$table,
'doktype',
[
'label' => 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/Database:form_custom_templates.pageType',
'value' => $emailDoktype,
'icon' => 'apps-pagetree-page-email',
'group' => 'special',
],
'254',
'before'
);
}

ArrayUtility::mergeRecursiveWithOverrule(
$GLOBALS['TCA'][$table],
Expand Down

0 comments on commit 5dd27de

Please sign in to comment.