TYPO3  7.6
form/Configuration/TCA/Overrides/tt_content.php
Go to the documentation of this file.
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
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;
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 
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 $GLOBALS['TCA']['tt_content']['columns']['bodytext']['config']['wizards']['forms'] = array(
38  'notNewRecords' => 1,
39  'enableByTypeConfig' => 1,
40  'type' => 'script',
41  'title' => 'Form wizard',
42  'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_forms.gif',
43  'module' => array(
44  'name' => 'wizard_form'
45  ),
46  'params' => array(
47  'xmlOutput' => 0
48  )
49 );
50 
51 // Add palettes if they are not available
52 if (!isset($GLOBALS['TCA']['tt_content']['palettes']['visibility'])) {
53  $GLOBALS['TCA']['tt_content']['palettes']['visibility'] = array(
54  'showitem' => '
55  hidden;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:hidden_formlabel,
56  sectionIndex;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:sectionIndex_formlabel,
57  linkToTop;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:linkToTop_formlabel
58  ',
59  );
60 }
61 
62 if (!isset($GLOBALS['TCA']['tt_content']['palettes']['frames'])) {
63  $GLOBALS['TCA']['tt_content']['palettes']['frames'] = array(
64  'showitem' => '
65  layout;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:layout_formlabel
66  ',
67  );
68 }
69 
70 $GLOBALS['TCA']['tt_content']['types']['mailform']['showitem'] = '
71  --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
72  --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,rowDescription,
73  --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.I.8,
74  bodytext;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext.ALT.mailform,
75  --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
76  --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
77  --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,
78  --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.visibility;visibility,
79  --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
80 ';
81 if (!is_array($GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides'])) {
82  $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides'] = array();
83 }
84 if (!is_array($GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext'])) {
85  $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext'] = array();
86 }
88 if (!empty($GLOBALS['TCA']['tt_content']['columns']['bodytext']['defaultExtras'])) {
89  $baseDefaultExtrasOfBodytext = $GLOBALS['TCA']['tt_content']['columns']['bodytext']['defaultExtras'] . ':';
90 }
91 $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext']['defaultExtras'] = $baseDefaultExtrasOfBodytext . 'nowrap:wizards[forms]';