[BUGFIX] Set correct default value for CType in TCA
[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 'EXT:t3skin/icons/gfx/i/tt_content_textpic.gif'
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 additional fields for bullets + upload CTypes
78 $additionalColumns = [
79 'bullets_type' => [
80 'exclude' => TRUE,
81 'label' => $languageFilePrefix . 'tt_content.bullets_type',
82 'config' => [
83 'type' => 'select',
84 'items' => [
85 [$languageFilePrefix . 'tt_content.bullets_type.0', 0],
86 [$languageFilePrefix . 'tt_content.bullets_type.1', 1],
87 [$languageFilePrefix . 'tt_content.bullets_type.2', 2]
88 ],
89 'default' => 0
90 ]
91 ],
92 'uploads_description' => [
93 'exclude' => TRUE,
94 'label' => $languageFilePrefix . 'tt_content.uploads_description',
95 'config' => [
96 'type' => 'check',
97 'default' => 0,
98 'items' => [
99 ['LLL:EXT:lang/locallang_core.xml:labels.enabled', 1]
100 ]
101 ]
102 ],
103 'uploads_type' => [
104 'exclude' => TRUE,
105 'label' => $languageFilePrefix . 'tt_content.uploads_type',
106 'config' => [
107 'type' => 'select',
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 ];
117
118 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $additionalColumns);
119 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tt_content', 'bullets_type', 'bullets', 'after:layout');
120 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette('tt_content', 'uploadslayout', 'uploads_description,uploads_type');
121 });