[TASK] Cleanup TCA select field configuration
[Packages/TYPO3.CMS.git] / typo3 / sysext / compatibility6 / Configuration / TCA / Overrides / tt_content.php
1 <?php
2 defined('TYPO3_MODE') or die();
3
4 //Extra fields for the tt_content table
5 $extraContentColumns = array(
6 'altText' => array(
7 'exclude' => TRUE,
8 'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_altText',
9 'config' => array(
10 'type' => 'text',
11 'cols' => '30',
12 'rows' => '3'
13 )
14 ),
15 'imagecaption' => array(
16 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.caption',
17 'config' => array(
18 'type' => 'text',
19 'cols' => '30',
20 'rows' => '3',
21 'softref' => 'typolink_tag,images,email[subst],url'
22 )
23 ),
24 'imagecaption_position' => array(
25 'exclude' => TRUE,
26 'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:imagecaption_position',
27 'config' => array(
28 'type' => 'select',
29 'renderType' => 'selectSingle',
30 'items' => array(
31 array(
32 'LLL:EXT:lang/locallang_general.xlf:LGL.default_value',
33 ''
34 ),
35 array(
36 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:imagecaption_position.I.1',
37 'center'
38 ),
39 array(
40 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:imagecaption_position.I.2',
41 'right'
42 ),
43 array(
44 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:imagecaption_position.I.3',
45 'left'
46 )
47 ),
48 'default' => ''
49 )
50 ),
51 'image_link' => array(
52 'exclude' => TRUE,
53 'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_link',
54 'config' => array(
55 'type' => 'text',
56 'cols' => '30',
57 'rows' => '3',
58 'wizards' => array(
59 'link' => array(
60 'type' => 'popup',
61 'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_link_formlabel',
62 'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_link.gif',
63 'module' => array(
64 'name' => 'wizard_element_browser',
65 'urlParameters' => array(
66 'mode' => 'wizard'
67 )
68 ),
69 'JSopenParams' => 'width=800,height=600,status=0,menubar=0,scrollbars=1'
70 )
71 ),
72 'softref' => 'typolink[linkList]'
73 )
74 ),
75 'image_frames' => array(
76 'exclude' => TRUE,
77 'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_frames',
78 'config' => array(
79 'type' => 'select',
80 'renderType' => 'selectSingle',
81 'items' => array(
82 array(
83 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_frames.I.0',
84 0
85 ),
86 array(
87 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_frames.I.1',
88 1
89 ),
90 array(
91 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_frames.I.2',
92 2
93 ),
94 array(
95 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_frames.I.3',
96 3
97 ),
98 array(
99 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_frames.I.4',
100 4
101 ),
102 array(
103 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_frames.I.5',
104 5
105 ),
106 array(
107 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_frames.I.6',
108 6
109 ),
110 array(
111 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_frames.I.7',
112 7
113 ),
114 array(
115 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_frames.I.8',
116 8
117 )
118 )
119 )
120 ),
121 'longdescURL' => array(
122 'exclude' => TRUE,
123 'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_longdescURL',
124 'config' => array(
125 'type' => 'text',
126 'cols' => '30',
127 'rows' => '3',
128 'wizards' => array(
129 'link' => array(
130 'type' => 'popup',
131 'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_link_formlabel',
132 'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_link.gif',
133 'module' => array(
134 'name' => 'wizard_element_browser',
135 'urlParameters' => array(
136 'mode' => 'wizard'
137 )
138 ),
139 'params' => array(
140 'blindLinkOptions' => 'folder,file,mail,spec',
141 'blindLinkFields' => 'target,title,class,params'
142 ),
143 'JSopenParams' => 'width=800,height=600,status=0,menubar=0,scrollbars=1'
144 )
145 ),
146 'softref' => 'typolink[linkList]'
147 )
148 ),
149 'titleText' => array(
150 'exclude' => TRUE,
151 'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_titleText',
152 'config' => array(
153 'type' => 'text',
154 'cols' => '30',
155 'rows' => '3'
156 )
157 )
158 );
159
160 // Adding fields to the tt_content table definition in TCA
161 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $extraContentColumns);
162
163 // Add default palettes
164 $GLOBALS['TCA']['tt_content']['palettes'] = array_replace(
165 $GLOBALS['TCA']['tt_content']['palettes'],
166 array(
167 '1' => array(
168 'showitem' => '
169 starttime,
170 endtime
171 '
172 ),
173 '2' => array(
174 'showitem' => '
175 imagecols,
176 image_noRows,
177 imageborder
178 '
179 ),
180 '3' => array(
181 'showitem' => '
182 header_position,
183 header_layout,
184 header_link,
185 date
186 '
187 ),
188 '4' => array(
189 'showitem' => '
190 sys_language_uid,
191 l18n_parent,
192 colPos,
193 spaceBefore,
194 spaceAfter,
195 section_frame,
196 sectionIndex
197 '
198 ),
199 '5' => array(
200 'showitem' => '
201 imagecaption_position
202 '
203 ),
204 '6' => array(
205 'showitem' => '
206 imagewidth,
207 image_link
208 '
209 ),
210 '7' => array(
211 'showitem' => '
212 image_link,
213 image_zoom
214 ',
215 ),
216 '8' => array(
217 'showitem' => '
218 layout
219 '
220 ),
221 '10' => array(
222 'showitem' => '
223 table_bgColor,
224 table_border,
225 table_cellspacing,
226 table_cellpadding
227 '
228 ),
229 '11' => array(
230 'showitem' => '
231 image_compression,
232 image_effects,
233 image_frames
234 ',
235 ),
236 '12' => array(
237 'showitem' => '
238 recursive
239 '
240 ),
241 '13' => array(
242 'showitem' => '
243 imagewidth,
244 imageheight
245 ',
246 ),
247 '14' => array(
248 'showitem' => '
249 sys_language_uid,
250 l18n_parent,
251 colPos
252 '
253 ),
254 'image_accessibility' => array(
255 'showitem' => '
256 altText;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:altText_formlabel,
257 titleText;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:titleText_formlabel,
258 --linebreak--,
259 longdescURL;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:longdescURL_formlabel
260 ',
261 )
262 )
263 );
264
265 // Add palettes from css_styled_content if css_styled_content is NOT loaded but needed for CE's "search" and "mailform"
266 if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('css_styled_content')) {
267 $GLOBALS['TCA']['tt_content']['palettes'] = array_replace(
268 $GLOBALS['TCA']['tt_content']['palettes'],
269 array(
270 'visibility' => array(
271 'showitem' => '
272 hidden;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:hidden_formlabel,
273 sectionIndex;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:sectionIndex_formlabel,
274 linkToTop;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:linkToTop_formlabel
275 ',
276 ),
277 'frames' => array(
278 'showitem' => '
279 layout;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:layout_formlabel,
280 spaceBefore;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:spaceBefore_formlabel,
281 spaceAfter;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:spaceAfter_formlabel,
282 section_frame;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:section_frame_formlabel
283 ',
284 )
285 )
286 );
287 }
288
289 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette('tt_content', 'image_settings', 'image_frames;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:image_frames_formlabel');
290
291 /**
292 * CType "search"
293 */
294 $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['search'] = 'mimetypes-x-content-form-search';
295 $GLOBALS['TCA']['tt_content']['types']['search'] = array(
296 'showitem' => '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
297 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,
298 --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
299 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
300 --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,
301 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.visibility;visibility,
302 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
303 --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.behaviour,
304 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.searchform;searchform,
305 --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.extended'
306 );
307
308 $GLOBALS['TCA']['tt_content']['palettes']['searchform'] = array(
309 'showitem' => 'pages;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:pages.ALT.searchform',
310 );
311
312 // check if there is already a forms tab and add the item after that, otherwise
313 // add the tab item as well
314 $additionalCTypeItem = array(
315 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.I.9',
316 'search',
317 'content-special-indexed_search'
318 );
319
320 $existingCTypeItems = $GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'];
321 $groupFound = FALSE;
322 $groupPosition = FALSE;
323 foreach ($existingCTypeItems as $position => $item) {
324 if ($item[0] === 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.div.forms') {
325 $groupFound = TRUE;
326 $groupPosition = $position;
327 break;
328 }
329 }
330
331 if ($groupFound && $groupPosition) {
332 // add the new CType item below CType
333 array_splice($GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'], $groupPosition+1, 0, array(0 => $additionalCTypeItem));
334 } else {
335 // nothing found, add two items (group + new CType) at the bottom of the list
336 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem('tt_content', 'CType',
337 array('LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.div.forms', '--div--')
338 );
339 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem('tt_content', 'CType', $additionalCTypeItem);
340 }
341
342
343 /**
344 * CType "mailform"
345 */
346 if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('form')) {
347 $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['mailform'] = 'mimetypes-x-content-form';
348 $GLOBALS['TCA']['tt_content']['columns']['bodytext']['config']['wizards']['forms'] = array(
349 'notNewRecords' => 1,
350 'enableByTypeConfig' => 1,
351 'type' => 'script',
352 'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext.W.forms',
353 'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_forms.gif',
354 'module' => array(
355 'name' => 'wizard_forms',
356 'urlParameters' => array(
357 'special' => 'formtype_mail'
358 )
359 ),
360 'params' => array(
361 'xmlOutput' => 0
362 )
363 );
364
365 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
366 'tt_content',
367 'CType',
368 array(
369 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.I.8',
370 'mailform',
371 'content-elements-mailform'
372 ),
373 'search',
374 'before'
375 );
376
377 // set up the fields
378 $GLOBALS['TCA']['tt_content']['types']['mailform'] = array(
379 'showitem' => '
380 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
381 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,
382 bodytext;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext.ALT.mailform_formlabel,
383 --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
384 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
385 --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,
386 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.visibility;visibility,
387 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
388 --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.behaviour,
389 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.mailform;mailform,
390 --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.extended'
391 );
392 $baseDefaultExtrasOfBodytext = '';
393 if (!empty($GLOBALS['TCA']['tt_content']['columns']['bodytext']['defaultExtras'])) {
394 $baseDefaultExtrasOfBodytext = $GLOBALS['TCA']['tt_content']['columns']['bodytext']['defaultExtras'] . ':';
395 }
396 if (!is_array($GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides'])) {
397 $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides'] = array();
398 }
399 if (!is_array($GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext'])) {
400 $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext'] = array();
401 }
402 $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext']['defaultExtras'] = $baseDefaultExtrasOfBodytext . 'nowrap:wizards[forms]';
403
404 $GLOBALS['TCA']['tt_content']['palettes']['mailform'] = array(
405 'showitem' => 'pages;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:pages.ALT.mailform, --linebreak--, subheader;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:subheader.ALT.mailform_formlabel',
406 );
407 }