[BUGFIX] Add textmedia CE's bodytext to BE search
[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,rowDescription,
41 bodytext;' . $frontendLanguageFilePrefix . 'bodytext_formlabel,
42 --div--;' . $frontendLanguageFilePrefix . 'tabs.media,
43 assets,
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' => ['bodytext' => ['defaultExtras' => 'richtext:rte_transform[mode=ts_css]']]
56 ];
57
58 $GLOBALS['TCA']['tt_content']['columns']['bodytext']['config']['search']['andWhere'] .= ' OR CType=\'textmedia\'';
59
60 // Add category tab when categories column exits
61 if (!empty($GLOBALS['TCA']['tt_content']['columns']['categories'])) {
62 $GLOBALS['TCA']['tt_content']['types']['textmedia']['showitem'] .=
63 ',--div--;LLL:EXT:lang/locallang_tca.xlf:sys_category.tabs.category,
64 categories';
65 }
66
67 // Add table wizard
68 $GLOBALS['TCA']['tt_content']['types']['table']['columnsOverrides']['bodytext']['defaultExtras'] = 'nowrap:wizards[table]';
69
70 // Add additional fields for bullets + upload CTypes
71 $additionalColumns = [
72 'bullets_type' => [
73 'exclude' => true,
74 'label' => $languageFilePrefix . 'tt_content.bullets_type',
75 'config' => [
76 'type' => 'select',
77 'renderType' => 'selectSingle',
78 'items' => [
79 [$languageFilePrefix . 'tt_content.bullets_type.0', 0],
80 [$languageFilePrefix . 'tt_content.bullets_type.1', 1],
81 [$languageFilePrefix . 'tt_content.bullets_type.2', 2]
82 ],
83 'default' => 0
84 ]
85 ],
86 'uploads_description' => [
87 'exclude' => true,
88 'label' => $languageFilePrefix . 'tt_content.uploads_description',
89 'config' => [
90 'type' => 'check',
91 'default' => 0,
92 'items' => [
93 ['LLL:EXT:lang/locallang_core.xml:labels.enabled', 1]
94 ]
95 ]
96 ],
97 'uploads_type' => [
98 'exclude' => true,
99 'label' => $languageFilePrefix . 'tt_content.uploads_type',
100 'config' => [
101 'type' => 'select',
102 'renderType' => 'selectSingle',
103 'items' => [
104 [$languageFilePrefix . 'tt_content.uploads_type.0', 0],
105 [$languageFilePrefix . 'tt_content.uploads_type.1', 1],
106 [$languageFilePrefix . 'tt_content.uploads_type.2', 2]
107 ],
108 'default' => 0
109 ]
110 ],
111 'assets' => [
112 'label' => $languageFilePrefix . 'tt_content.asset_references',
113 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('assets', [
114 'appearance' => [
115 'createNewRelationLinkTitle' => $languageFilePrefix . 'tt_content.asset_references.addFileReference'
116 ],
117 // custom configuration for displaying fields in the overlay/reference table
118 // behaves the same as the image field.
119 'foreign_types' => $GLOBALS['TCA']['tt_content']['columns']['image']['config']['foreign_types']
120 ], $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext'])
121 ],
122 ];
123
124 $GLOBALS['TCA']['tt_content']['ctrl']['thumbnail'] = 'assets';
125
126 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $additionalColumns);
127 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tt_content', 'bullets_type', 'bullets', 'after:layout');
128 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette('tt_content', 'uploadslayout', 'uploads_description,uploads_type');
129 });