forked from 1up-lab/contao-efg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtl_form_field.php
226 lines (203 loc) · 10.7 KB
/
tl_form_field.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<?php
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2014 Leo Feyer
*
* @package Efg
* @author Thomas Kuhn <[email protected]>
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
* @copyright Thomas Kuhn 2007-2014
*/
// Table tl_form_fields
$GLOBALS['TL_DCA']['tl_form_field']['list']['sorting']['headerFields'][] = 'storeFormdata';
$GLOBALS['TL_DCA']['tl_form_field']['list']['sorting']['headerFields'][] = 'sendConfirmationMail';
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgLookupOptions'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgLookupOptions'],
'exclude' => true,
'inputType' => 'efgLookupOptionWizard',
'sql' => "text NULL"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgMultiSRC'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgMultiSRC'],
'exclude' => true,
'inputType' => 'fileTree',
'eval' => array('fieldType'=>'checkbox', 'multiple'=>true, 'files'=>true, 'mandatory'=>true, 'extensions' => 'gif,jpg,png'),
'sql' => "blob NULL"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['mandatory']['eval']['tl_class'] = 'w50 cbx';
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgImageMultiple'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgImageMultiple'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class' => 'w50 cbx'),
'sql' => "char(1) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgImageUseHomeDir'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgImageUseHomeDir'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class' => 'w50 m12 cbx'),
'sql' => "char(1) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgImageSortBy'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgImageSortBy'],
'exclude' => true,
'inputType' => 'select',
'options' => array('name_asc', 'name_desc', 'date_asc', 'date_desc', 'random'),
'reference' => &$GLOBALS['TL_LANG']['tl_form_field'],
'eval' => array('tl_class' => 'w50'),
'sql' => "varchar(32) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgImageSize'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgImageSize'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('multiple'=>true, 'size'=>2, 'rgxp'=>'digit', 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgImagePerRow'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgImagePerRow'],
'default' => 4,
'exclude' => true,
'inputType' => 'select',
'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12),
'eval' => array('tl_class' => 'w50'),
'sql' => "smallint(5) unsigned NOT NULL default '0'"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgImageMargin'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgImageMargin'],
'exclude' => true,
'inputType' => 'trbl',
'options' => array('px', '%', 'em', 'pt', 'pc', 'in', 'cm', 'mm'),
'eval' => array('includeBlankOption'=>true, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgImageFullsize'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgImageFullsize'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class' => 'w50 m12 cbx'),
'sql' => "char(1) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgAddBackButton'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgAddBackButton'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('submitOnChange'=>true, 'tl_class'=>'w50'),
'sql' => "char(1) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgBackSlabel'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgBackSlabel'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'maxlength'=>255, 'tl_class'=>'clr'),
'sql' => "varchar(255) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgSwitchButtonOrder'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgSwitchButtonOrder'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class'=>'w50 cbx'),
'sql' => "char(1) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgBackStoreSessionValues'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgBackStoreSessionValues'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class'=>'w50 cbx'),
'sql' => "char(1) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgBackImageSubmit'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgBackImageSubmit'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('submitOnChange'=>true, 'tl_class'=>'clr'),
'sql' => "char(1) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_form_field']['fields']['efgBackSingleSRC'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['efgBackSingleSRC'],
'exclude' => true,
'inputType' => 'fileTree',
'eval' => array('fieldType'=>'radio', 'files'=>true, 'filesOnly'=>true,'extensions' => 'gif,jpg,png', 'mandatory'=>true, 'tl_class'=>'clr'),
'sql' => "binary(16) NULL"
);
// Add palettes
if (is_array($GLOBALS['TL_DCA']['tl_form_field']['palettes']))
{
// Field type efgLookupSelect
array_insert($GLOBALS['TL_DCA']['tl_form_field']['palettes'], count($GLOBALS['TL_DCA']['tl_form_field']['palettes']),
array('efgLookupSelect' => '{type_legend},type,name,label;{options_legend},efgLookupOptions;{fconfig_legend},mandatory,multiple;{expert_legend:hide},accesskey,class;{submit_legend},addSubmit')
);
// Field type efgLookupCheckbox
array_insert($GLOBALS['TL_DCA']['tl_form_field']['palettes'], count($GLOBALS['TL_DCA']['tl_form_field']['palettes']),
array('efgLookupCheckbox' => '{type_legend},type,name,label;{options_legend},efgLookupOptions;{fconfig_legend},mandatory;{expert_legend:hide},accesskey,class;{submit_legend},addSubmit')
);
// Field type efgLookupRadio
array_insert($GLOBALS['TL_DCA']['tl_form_field']['palettes'], count($GLOBALS['TL_DCA']['tl_form_field']['palettes']),
array('efgLookupRadio' => '{type_legend},type,name,label;{options_legend},efgLookupOptions;{fconfig_legend},mandatory;{expert_legend:hide},accesskey,class;{submit_legend},addSubmit')
);
// Field type efgImageSelect
array_insert($GLOBALS['TL_DCA']['tl_form_field']['palettes'], count($GLOBALS['TL_DCA']['tl_form_field']['palettes']),
array('efgImageSelect' => '{type_legend},type,name,label;{options_legend},efgMultiSRC,efgImageUseHomeDir,efgImageFullsize,efgImageSize,efgImageMargin,efgImagePerRow,efgImageSortBy;{fconfig_legend},mandatory,efgImageMultiple;{expert_legend:hide},accesskey,class;{submit_legend},addSubmit')
);
// Field type efgFormPaginator
array_insert($GLOBALS['TL_DCA']['tl_form_field']['palettes'], count($GLOBALS['TL_DCA']['tl_form_field']['palettes']),
array('efgFormPaginator' => '{type_legend},type,slabel;{image_legend:hide},imageSubmit;{backbutton_legend},efgAddBackButton;{expert_legend:hide},class,accesskey')
);
$GLOBALS['TL_DCA']['tl_form_field']['palettes']['__selector__'][] = 'efgAddBackButton';
$GLOBALS['TL_DCA']['tl_form_field']['palettes']['__selector__'][] = 'efgBackImageSubmit';
$GLOBALS['TL_DCA']['tl_form_field']['subpalettes']['efgAddBackButton'] = 'efgBackSlabel,efgSwitchButtonOrder,efgBackStoreSessionValues,efgBackImageSubmit';
$GLOBALS['TL_DCA']['tl_form_field']['subpalettes']['efgBackImageSubmit'] = 'efgBackSingleSRC';
}
// Add field types to type options
if (is_array($GLOBALS['TL_DCA']['tl_form_field']['fields']['type']['options']))
{
// Field type efgLookupSelect
array_insert($GLOBALS['TL_DCA']['tl_form_field']['fields']['type']['options'], (array_search('select', $GLOBALS['TL_DCA']['tl_form_field']['fields']['type']['options'])+1),
'efgLookupSelect'
);
// Field type efgLookupCheckbox
array_insert($GLOBALS['TL_DCA']['tl_form_field']['fields']['type']['options'], (array_search('checkbox', $GLOBALS['TL_DCA']['tl_form_field']['fields']['type']['options'])+1),
'efgLookupCheckbox'
);
// Field type efgLookupRadio
array_insert($GLOBALS['TL_DCA']['tl_form_field']['fields']['type']['options'], (array_search('radio', $GLOBALS['TL_DCA']['tl_form_field']['fields']['type']['options'])+1),
'efgLookupRadio'
);
// Field type efgImageSelect
array_insert($GLOBALS['TL_DCA']['tl_form_field']['fields']['type']['options'], (array_search('upload', $GLOBALS['TL_DCA']['tl_form_field']['fields']['type']['options'])+1),
'efgImageSelect'
);
// Field type efgFormPaginator
array_insert($GLOBALS['TL_DCA']['tl_form_field']['fields']['type']['options'], (array_search('submit', $GLOBALS['TL_DCA']['tl_form_field']['fields']['type']['options'])+1),
'efgFormPaginator'
);
}
// Add backend form fields
$GLOBALS['BE_FFL']['efgLookupOptionWizard'] = 'EfgLookupOptionWizard';
$GLOBALS['BE_FFL']['efgLookupSelect'] = 'EfgFormLookupSelectMenu';
$GLOBALS['BE_FFL']['efgLookupCheckbox'] = 'EfgFormLookupCheckbox';
$GLOBALS['BE_FFL']['efgLookupRadio'] = 'EfgFormLookupRadio';
$GLOBALS['BE_FFL']['efgFormPaginator'] = 'EfgFormPaginator';
// Add front end form fields
$GLOBALS['TL_FFL']['efgLookupSelect'] = 'EfgFormLookupSelectMenu';
$GLOBALS['TL_FFL']['efgLookupCheckbox'] = 'EfgFormLookupCheckbox';
$GLOBALS['TL_FFL']['efgLookupRadio'] = 'EfgFormLookupRadio';
$GLOBALS['TL_FFL']['efgImageSelect'] = 'EfgFormImageSelect';
$GLOBALS['TL_FFL']['efgFormPaginator'] = 'EfgFormPaginator';