[!!!][FEATURE] FormEngine element level refactoring
[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 $languageFilePrefix = 'LLL:EXT:fluid_styled_content/Resources/Private/Language/Database.xlf:';
6 $frontendLanguageFilePrefix = 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:';
7
8 // Add the CType "textmedia"
9 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
10 'tt_content',
11 'CType',
12 [
13 $languageFilePrefix . 'tt_content.CType.textmedia',
14 'textmedia',
15 'content-textmedia'
16 ],
17 'header',
18 'after'
19 );
20 $GLOBALS['TCA']['tt_content']['columns']['CType']['config']['default'] = 'textmedia';
21
22 $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['textmedia'] = 'mimetypes-x-content-text-media';
23 $GLOBALS['TCA']['tt_content']['palettes']['mediaAdjustments'] = [
24 'showitem' => '
25 imagewidth;' . $languageFilePrefix . 'tt_content.palette.textmedia.imagewidth,
26 imageheight;' . $languageFilePrefix . 'tt_content.palette.textmedia.imageheight,
27 imageborder;' . $languageFilePrefix . 'tt_content.palette.textmedia.imageborder
28 '
29 ];
30 $GLOBALS['TCA']['tt_content']['palettes']['gallerySettings'] = [
31 'showitem' => '
32 imageorient;' . $frontendLanguageFilePrefix . 'imageorient_formlabel,
33 imagecols;' . $frontendLanguageFilePrefix . 'imagecols_formlabel
34 '
35 ];
36 $GLOBALS['TCA']['tt_content']['types']['textmedia']['showitem'] = '
37 --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
38 --palette--;' . $frontendLanguageFilePrefix . 'palette.general;general,
39 --palette--;' . $frontendLanguageFilePrefix . 'palette.header;header,
40 bodytext;' . $frontendLanguageFilePrefix . 'bodytext_formlabel,
41 --div--;' . $frontendLanguageFilePrefix . 'tabs.media,
42 assets,
43 --palette--;' . $frontendLanguageFilePrefix . 'palette.imagelinks;imagelinks,
44 --div--;' . $frontendLanguageFilePrefix . 'tabs.appearance,
45 layout;' . $frontendLanguageFilePrefix . 'layout_formlabel,
46 --palette--;' . $languageFilePrefix . 'tt_content.palette.mediaAdjustments;mediaAdjustments,
47 --palette--;' . $languageFilePrefix . 'tt_content.palette.gallerySettings;gallerySettings,
48 --palette--;' . $frontendLanguageFilePrefix . 'palette.appearanceLinks;appearanceLinks,
49 --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
50 --palette--;;language,
51 --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
52 --palette--;;hidden,
53 --palette--;' . $frontendLanguageFilePrefix . 'palette.access;access,
54 --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,
55 categories,
56 --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,
57 rowDescription,
58 --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended,
59 ';
60
61 if (!isset($GLOBALS['TCA']['tt_content']['types']['textmedia']['columnsOverrides']['bodytext']['config'])
62 || !is_array($GLOBALS['TCA']['tt_content']['types']['textmedia']['columnsOverrides']['bodytext']['config'])
63 ) {
64 $GLOBALS['TCA']['tt_content']['types']['textmedia']['columnsOverrides']['bodytext']['config'] = [];
65 }
66 $GLOBALS['TCA']['tt_content']['types']['textmedia']['columnsOverrides']['bodytext']['config']['enableRichtext'] = true;
67 $GLOBALS['TCA']['tt_content']['types']['textmedia']['columnsOverrides']['bodytext']['config']['richtextConfiguration'] = 'default';
68
69 $GLOBALS['TCA']['tt_content']['columns']['bodytext']['config']['search']['andWhere'] .= ' OR CType=\'textmedia\'';
70
71 // Add table wizard
72 $GLOBALS['TCA']['tt_content']['types']['table']['columnsOverrides']['bodytext']['config']['renderType'] = 'textTable';
73 $GLOBALS['TCA']['tt_content']['types']['table']['columnsOverrides']['bodytext']['config']['wrap'] = 'off';
74
75 // Add additional fields for bullets + upload CTypes
76 $additionalColumns = [
77 'bullets_type' => [
78 'exclude' => true,
79 'label' => $languageFilePrefix . 'tt_content.bullets_type',
80 'config' => [
81 'type' => 'select',
82 'renderType' => 'selectSingle',
83 'items' => [
84 [$languageFilePrefix . 'tt_content.bullets_type.0', 0],
85 [$languageFilePrefix . 'tt_content.bullets_type.1', 1],
86 [$languageFilePrefix . 'tt_content.bullets_type.2', 2]
87 ],
88 'default' => 0
89 ]
90 ],
91 'uploads_description' => [
92 'exclude' => true,
93 'label' => $languageFilePrefix . 'tt_content.uploads_description',
94 'config' => [
95 'type' => 'check',
96 'default' => 0,
97 'items' => [
98 ['LLL:EXT:lang/Resources/Private/Language/locallang_core.xml:labels.enabled', 1]
99 ]
100 ]
101 ],
102 'uploads_type' => [
103 'exclude' => true,
104 'label' => $languageFilePrefix . 'tt_content.uploads_type',
105 'config' => [
106 'type' => 'select',
107 'renderType' => 'selectSingle',
108 'items' => [
109 [$languageFilePrefix . 'tt_content.uploads_type.0', 0],
110 [$languageFilePrefix . 'tt_content.uploads_type.1', 1],
111 [$languageFilePrefix . 'tt_content.uploads_type.2', 2]
112 ],
113 'default' => 0
114 ]
115 ],
116 'assets' => [
117 'label' => $languageFilePrefix . 'tt_content.asset_references',
118 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('assets', [
119 'appearance' => [
120 'createNewRelationLinkTitle' => $languageFilePrefix . 'tt_content.asset_references.addFileReference'
121 ],
122 // custom configuration for displaying fields in the overlay/reference table
123 // behaves the same as the image field.
124 'foreign_types' => $GLOBALS['TCA']['tt_content']['columns']['image']['config']['foreign_types']
125 ], $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext'])
126 ],
127 ];
128
129 $GLOBALS['TCA']['tt_content']['ctrl']['thumbnail'] = 'assets';
130
131 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $additionalColumns);
132 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tt_content', 'bullets_type', 'bullets', 'after:layout');
133 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette('tt_content', 'uploadslayout', 'uploads_description,uploads_type');
134 });