Skip to content

Commit

Permalink
[TASK] Simplify TCA
Browse files Browse the repository at this point in the history
  • Loading branch information
georgringer committed Nov 19, 2024
1 parent 5aae767 commit 09b50b0
Showing 1 changed file with 11 additions and 24 deletions.
35 changes: 11 additions & 24 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$pluginConfig = ['pi1', 'news_list_sticky', 'news_detail', 'news_selected_list', 'news_date_menu', 'category_list', 'news_search_form', 'news_search_result', 'tag_list'];
foreach ($pluginConfig as $pluginName) {
$pluginNameForLabel = $pluginName === 'pi1' ? 'news_list' : $pluginName;
ExtensionUtility::registerPlugin(
$pluginIdentifier = ExtensionUtility::registerPlugin(
'news',
GeneralUtility::underscoredToUpperCamelCase($pluginName),
'LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:plugin.' . $pluginNameForLabel . '.title',
Expand All @@ -25,31 +25,18 @@
ExtensionManagementUtility::addPiFlexFormValue(
'*',
'FILE:EXT:news/Configuration/FlexForms/flexform_' . $flexformFileName . '.xml',
$contentTypeName
$pluginIdentifier
);
// Add the FlexForm to the show item list
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'tt_content',
'--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.plugin, pi_flexform',
$pluginIdentifier,
'after:palette:headers'
);
$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes'][$contentTypeName] = 'ext-news-plugin-' . str_replace('_', '-', $pluginNameForLabel);

$GLOBALS['TCA']['tt_content']['types'][$contentTypeName]['previewRenderer'] = PluginPreviewRenderer::class;
$GLOBALS['TCA']['tt_content']['types'][$contentTypeName]['showitem'] = '
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
--palette--;;general,
--palette--;;headers,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.plugin,
pi_flexform,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
--palette--;;frames,
--palette--;;appearanceLinks,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
--palette--;;language,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;;hidden,
--palette--;;access,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,
categories,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,
rowDescription,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended,
';
$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes'][$pluginIdentifier] = 'ext-news-plugin-' . str_replace('_', '-', $pluginNameForLabel);
$GLOBALS['TCA']['tt_content']['types'][$pluginIdentifier]['previewRenderer'] = PluginPreviewRenderer::class;
}

$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['itemGroups']['news'] = 'LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:pi1_title';
Expand Down

0 comments on commit 09b50b0

Please sign in to comment.