12192154aa68ada797aa86b6d320bbc5b4310368
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Configuration / TCA / Overrides / tt_content.php
1 <?php
2 defined('TYPO3_MODE') or die();
3
4 // add an CType element "mailform"
5 $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['mailform'] = 'mimetypes-x-content-form';
6
7 // check if there is already a forms tab and add the item after that, otherwise
8 // add the tab item as well
9 $additionalCTypeItem = array(
10 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.I.8',
11 'mailform',
12 'content-elements-mailform'
13 );
14
15 $existingCTypeItems = $GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'];
16 $groupFound = false;
17 $groupPosition = false;
18 foreach ($existingCTypeItems as $position => $item) {
19 if ($item[0] === 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.div.forms') {
20 $groupFound = true;
21 $groupPosition = $position;
22 break;
23 }
24 }
25
26 if ($groupFound && $groupPosition) {
27 // add the new CType item below CType
28 array_splice($GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'], $groupPosition+1, 0, array(0 => $additionalCTypeItem));
29 } else {
30 // nothing found, add two items (group + new CType) at the bottom of the list
31 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem('tt_content', 'CType',
32 array('LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.div.forms', '--div--')
33 );
34 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem('tt_content', 'CType', $additionalCTypeItem);
35 }
36
37 // predefined forms
38 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
39 'tt_content',
40 array(
41 'tx_form_predefinedform' => array(
42 'label' => 'LLL:EXT:form/Resources/Private/Language/Database.xlf:tx_form_predefinedform',
43 'exclude' => 1,
44 'config' => array(
45 'type' => 'select',
46 'renderType' => 'selectSingle',
47 'items' => array(
48 array(
49 'LLL:EXT:form/Resources/Private/Language/Database.xlf:tx_form_predefinedform.selectPredefinedForm',
50 ''
51 ),
52 ),
53 ),
54 ),
55 )
56 );
57 $GLOBALS['TCA']['tt_content']['ctrl']['requestUpdate'] .= ',tx_form_predefinedform';
58
59 // Hide bodytext if a predefined form is selected
60 $GLOBALS['TCA']['tt_content']['columns']['bodytext']['displayCond']['AND'] = array(
61 'OR' => array(
62 'FIELD:CType:!=:mailform',
63 'AND' => array(
64 'FIELD:CType:=:mailform',
65 'FIELD:tx_form_predefinedform:REQ:false',
66 ),
67 ),
68 );
69
70 $GLOBALS['TCA']['tt_content']['columns']['bodytext']['config']['wizards']['forms'] = array(
71 'notNewRecords' => 1,
72 'enableByTypeConfig' => 1,
73 'type' => 'script',
74 'title' => 'Form wizard',
75 'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_forms.gif',
76 'module' => array(
77 'name' => 'wizard_form'
78 ),
79 'params' => array(
80 'xmlOutput' => 0
81 )
82 );
83
84 // Add palettes if they are not available
85 if (!isset($GLOBALS['TCA']['tt_content']['palettes']['visibility'])) {
86 $GLOBALS['TCA']['tt_content']['palettes']['visibility'] = array(
87 'showitem' => '
88 hidden;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:hidden_formlabel,
89 sectionIndex;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:sectionIndex_formlabel,
90 linkToTop;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:linkToTop_formlabel
91 ',
92 );
93 }
94
95 if (!isset($GLOBALS['TCA']['tt_content']['palettes']['frames'])) {
96 $GLOBALS['TCA']['tt_content']['palettes']['frames'] = array(
97 'showitem' => '
98 layout;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:layout_formlabel
99 ',
100 );
101 }
102
103 $GLOBALS['TCA']['tt_content']['types']['mailform']['showitem'] = '
104 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
105 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,rowDescription,
106 --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.I.8,
107 bodytext;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext.ALT.mailform,
108 tx_form_predefinedform;LLL:EXT:form/Resources/Private/Language/Database.xlf:tx_form_predefinedform,
109 --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
110 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
111 --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,
112 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.visibility;visibility,
113 --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
114 ';
115 if (!is_array($GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides'])) {
116 $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides'] = array();
117 }
118 if (!is_array($GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext'])) {
119 $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext'] = array();
120 }
121 $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext']['config']['renderType'] = 'formwizard';