[TASK] Cleanup TCA select field configuration
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid_styled_content / Configuration / TCA / Overrides / tt_content.php
1 <?php
2 defined('TYPO3_MODE') or die();
3
4 call_user_func(function() {
5
6 $languageFilePrefix = 'LLL:EXT:fluid_styled_content/Resources/Private/Language/Database.xlf:';
7 $frontendLanguageFilePrefix = 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:';
8
9 // Add the CType "textmedia"
10 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
11 'tt_content',
12 'CType',
13 [
14 $languageFilePrefix . 'tt_content.CType.textmedia',
15 'textmedia',
16 'content-textpic'
17 ],
18 'header',
19 'after'
20 );
21 $GLOBALS['TCA']['tt_content']['columns']['CType']['config']['default'] = 'textmedia';
22
23 $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['textmedia'] = 'mimetypes-x-content-text-media';
24 $GLOBALS['TCA']['tt_content']['palettes']['mediaAdjustments'] = [
25 'showitem' => '
26 imagewidth;' . $languageFilePrefix . 'tt_content.palette.textmedia.imagewidth,
27 imageheight;' . $languageFilePrefix . 'tt_content.palette.textmedia.imageheight,
28 imageborder;' . $languageFilePrefix . 'tt_content.palette.textmedia.imageborder
29 '
30 ];
31 $GLOBALS['TCA']['tt_content']['palettes']['gallerySettings'] = [
32 'showitem' => '
33 imageorient;' . $frontendLanguageFilePrefix . 'imageorient_formlabel,
34 imagecols;' . $frontendLanguageFilePrefix . 'imagecols_formlabel
35 '
36 ];
37 $GLOBALS['TCA']['tt_content']['types']['textmedia'] = [
38 'showitem' => '
39 --palette--;' . $frontendLanguageFilePrefix . 'palette.general;general,
40 --palette--;' . $frontendLanguageFilePrefix . 'palette.header;header,
41 bodytext;' . $frontendLanguageFilePrefix . 'bodytext_formlabel;;richtext:rte_transform[mode=ts_css],
42 --div--;' . $frontendLanguageFilePrefix . 'tabs.media,
43 media,
44 --palette--;' . $frontendLanguageFilePrefix . 'palette.imagelinks;imagelinks,
45 --div--;' . $frontendLanguageFilePrefix . 'tabs.appearance,
46 layout;' . $frontendLanguageFilePrefix . 'layout_formlabel,
47 --palette--;' . $languageFilePrefix . 'tt_content.palette.mediaAdjustments;mediaAdjustments,
48 --palette--;' . $languageFilePrefix . 'tt_content.palette.gallerySettings;gallerySettings,
49 --palette--;' . $frontendLanguageFilePrefix . 'palette.appearanceLinks;appearanceLinks,
50 --div--;' . $frontendLanguageFilePrefix . 'tabs.access,
51 hidden;' . $frontendLanguageFilePrefix . 'field.default.hidden,
52 --palette--;' . $frontendLanguageFilePrefix . 'palette.access;access,
53 --div--;' . $frontendLanguageFilePrefix . 'tabs.extended
54 ',
55 'columnsOverrides' => [
56 'media' => [
57 'label' => $languageFilePrefix . 'tt_content.media_references',
58 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('media', [
59 'appearance' => [
60 'createNewRelationLinkTitle' => $languageFilePrefix . 'tt_content.media_references.addFileReference'
61 ],
62 // custom configuration for displaying fields in the overlay/reference table
63 // behaves the same as the image field.
64 'foreign_types' => $GLOBALS['TCA']['tt_content']['columns']['image']['config']['foreign_types']
65 ], $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext'])
66 ]
67 ]
68 ];
69
70 // Add category tab when categories column exits
71 if (!empty($GLOBALS['TCA']['tt_content']['columns']['categories'])) {
72 $GLOBALS['TCA']['tt_content']['types']['textmedia']['showitem'] .=
73 ',--div--;LLL:EXT:lang/locallang_tca.xlf:sys_category.tabs.category,
74 categories';
75 }
76
77 // Add table wizard
78 $GLOBALS['TCA']['tt_content']['types']['table']['columnsOverrides']['bodytext']['defaultExtras'] = 'nowrap:wizards[table]';
79
80 // Add additional fields for bullets + upload CTypes
81 $additionalColumns = [
82 'bullets_type' => [
83 'exclude' => TRUE,
84 'label' => $languageFilePrefix . 'tt_content.bullets_type',
85 'config' => [
86 'type' => 'select',
87 'renderType' => 'selectSingle',
88 'items' => [
89 [$languageFilePrefix . 'tt_content.bullets_type.0', 0],
90 [$languageFilePrefix . 'tt_content.bullets_type.1', 1],
91 [$languageFilePrefix . 'tt_content.bullets_type.2', 2]
92 ],
93 'default' => 0
94 ]
95 ],
96 'uploads_description' => [
97 'exclude' => TRUE,
98 'label' => $languageFilePrefix . 'tt_content.uploads_description',
99 'config' => [
100 'type' => 'check',
101 'default' => 0,
102 'items' => [
103 ['LLL:EXT:lang/locallang_core.xml:labels.enabled', 1]
104 ]
105 ]
106 ],
107 'uploads_type' => [
108 'exclude' => TRUE,
109 'label' => $languageFilePrefix . 'tt_content.uploads_type',
110 'config' => [
111 'type' => 'select',
112 'renderType' => 'selectSingle',
113 'items' => [
114 [$languageFilePrefix . 'tt_content.uploads_type.0', 0],
115 [$languageFilePrefix . 'tt_content.uploads_type.1', 1],
116 [$languageFilePrefix . 'tt_content.uploads_type.2', 2]
117 ],
118 'default' => 0
119 ]
120 ]
121 ];
122
123 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $additionalColumns);
124 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tt_content', 'bullets_type', 'bullets', 'after:layout');
125 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette('tt_content', 'uploadslayout', 'uploads_description,uploads_type');
126 });