Skip to content

Commit

Permalink
Merge pull request #11 from b13/tca-deprecations
Browse files Browse the repository at this point in the history
[TASK] Use new "link" TCA type for TYPO3 12+
  • Loading branch information
jschlier authored Oct 8, 2024
2 parents 0bc06f5 + 97023fb commit 0b25333
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,15 @@
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', [
'tx_cta_link' => [
'label' => 'LLL:EXT:cta/Resources/Private/Language/locallang_db.xlf:link.formlabel',
'config' => [
'type' => 'input',
'renderType' => 'inputLink',
'size' => '30',
'max' => '1024',
'eval' => 'trim',
'fieldControl' => [
'linkPopup' => [
'options' => [
'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_link_formlabel',
],
],
],
'softref' => 'typolink'
]
'config' => [],
],
'tx_cta_linklabel' => [
'label' => 'LLL:EXT:cta/Resources/Private/Language/locallang_db.xlf:linklabel.formlabel',
'config' => [
'type' => 'input',
'size' => '30',
'max' => '256',
]
],
],
'tx_cta_linkconfig' => [
'label' => 'LLL:EXT:cta/Resources/Private/Language/locallang_db.xlf:linkconfig.formlabel',
Expand All @@ -40,6 +26,21 @@
]);

if ((\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Information\Typo3Version::class))->getMajorVersion() < 12) {
$GLOBALS['TCA']['tt_content']['columns']['tx_cta_link']['config'] = [
'type' => 'input',
'renderType' => 'inputLink',
'size' => '30',
'max' => '1024',
'eval' => 'trim',
'fieldControl' => [
'linkPopup' => [
'options' => [
'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_link_formlabel',
],
],
],
'softref' => 'typolink'
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
'tt_content',
'CType',
Expand All @@ -48,6 +49,13 @@
'after'
);
} else {
$GLOBALS['TCA']['tt_content']['columns']['tx_cta_link']['config'] = [
'type' => 'link',
'size' => '30',
'appearance' => [
'browserTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_link_formlabel',
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
'tt_content',
'CType',
Expand Down

0 comments on commit 0b25333

Please sign in to comment.