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