PluginProbe
The Innovative Form Builder – IvyForms / 1.1
The Innovative Form Builder – IvyForms v1.1
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / Template / EventTShirtOrderFormTemplate.php

EventTShirtOrderFormTemplate.php in The Innovative Form Builder – IvyForms 1.1, at backend/src/Services/Template/EventTShirtOrderFormTemplate.php

357 lines 12.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IvyForms\Services\Template;
4
5 use IvyForms\Services\Translations\BackendStrings;
6
7 class EventTShirtOrderFormTemplate
8 {
9 /**
10 * Get template metadata (without form_data)
11 *
12 * @return array<string, mixed>
13 */
14 public static function getTemplateMeta(): array
15 {
16 return [
17 'id' => 'event_tshirt_order_form',
18 'name' => BackendStrings::getTemplateStrings()['event_tshirt_order_form'],
19 'description' => BackendStrings::getTemplateStrings()['event_tshirt_order_form_desc'],
20 'category' => 'order-forms',
21 'subcategory' => 'tshirt-order-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'event-tshirt-order-form.svg'
24 ];
25 }
26
27 /**
28 * Get the full template including form data
29 *
30 * @return array<string, mixed>
31 */
32 public static function getTemplate(): array
33 {
34 return array_merge(
35 self::getTemplateMeta(),
36 [
37 'form_data' => [
38 'name' => BackendStrings::getTemplateStrings()['event_tshirt_order_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getRequestorInformationFields(),
45 self::getEventDetailsFields(),
46 self::getTShirtDetailsFields(),
47 self::getAdditionalOptionsFields()
48 ),
49 'settings' => []
50 ]
51 ]
52 );
53 }
54
55 /**
56 * Get requestor information fields
57 *
58 * @return array<int, array<string, mixed>>
59 */
60 private static function getRequestorInformationFields(): array
61 {
62 return [
63 // Name Field - Parent
64 [
65 'id' => 1,
66 'fieldIndex' => 1,
67 'type' => 'name',
68 'label' => BackendStrings::getTemplateStrings()['requestor_name'],
69 'parentId' => null,
70 'defaultValue' => '',
71 'placeholder' => '',
72 'required' => true,
73 'readonly' => false,
74 'position' => 1,
75 ],
76 // First Name - Child of Name Field
77 [
78 'id' => 2,
79 'type' => 'text',
80 'label' => BackendStrings::getNewFormStrings()['first_name'],
81 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
82 'required' => true,
83 'parentId' => 1,
84 'fieldIndex' => 1,
85 'defaultValue' => '',
86 'position' => 1,
87 'optionHide' => false,
88 'description' => '',
89 'settings' => json_encode(['nameFieldType' => 'nameField1']),
90 ],
91 // Last Name - Child of Name Field
92 [
93 'id' => 3,
94 'type' => 'text',
95 'label' => BackendStrings::getNewFormStrings()['last_name'],
96 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
97 'required' => true,
98 'parentId' => 1,
99 'fieldIndex' => 1,
100 'defaultValue' => '',
101 'position' => 2,
102 'optionHide' => false,
103 'description' => '',
104 'settings' => json_encode(['nameFieldType' => 'nameField2']),
105 ],
106 // Email Address
107 [
108 'id' => 4,
109 'fieldIndex' => 2,
110 'type' => 'email',
111 'label' => BackendStrings::getTemplateStrings()['email_address'],
112 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_email_address'],
113 'required' => true,
114 'parentId' => null,
115 'defaultValue' => '',
116 'position' => 2,
117 ],
118 // Phone Number
119 [
120 'id' => 5,
121 'fieldIndex' => 3,
122 'type' => 'phone',
123 'label' => BackendStrings::getTemplateStrings()['phone_number'],
124 'placeholder' => '+1 (_) _-_',
125 'required' => false,
126 'parentId' => null,
127 'defaultValue' => '',
128 'position' => 3,
129 'phoneAutoDetect' => true,
130 ],
131 ];
132 }
133
134 /**
135 * Get event details fields
136 *
137 * @return array<int, array<string, mixed>>
138 */
139 private static function getEventDetailsFields(): array
140 {
141 return [
142 // Event Name
143 [
144 'id' => 6,
145 'fieldIndex' => 4,
146 'type' => 'text',
147 'label' => BackendStrings::getTemplateStrings()['event_name'],
148 'placeholder' => BackendStrings::getTemplateStrings()['enter_event_name'],
149 'required' => true,
150 'parentId' => null,
151 'defaultValue' => '',
152 'position' => 4,
153 ],
154 ];
155 }
156
157 /**
158 * Get t-shirt details fields
159 *
160 * @return array<int, array<string, mixed>>
161 */
162 private static function getTShirtDetailsFields(): array
163 {
164 return [
165 // T-Shirt Size
166 [
167 'id' => 13,
168 'fieldIndex' => 5,
169 'type' => 'select',
170 'label' => BackendStrings::getTemplateStrings()['tshirt_size'],
171 'placeholder' => BackendStrings::getTemplateStrings()['select_tshirt_size'],
172 'required' => true,
173 'parentId' => null,
174 'defaultValue' => '',
175 'position' => 5,
176 'fieldOptions' => [
177 [
178 'id' => 7,
179 'label' => BackendStrings::getTemplateStrings()['xs'],
180 'value' => 'xs',
181 'isDefault' => false,
182 'position' => 1
183 ],
184 [
185 'id' => 8,
186 'label' => BackendStrings::getTemplateStrings()['s'],
187 'value' => 's',
188 'isDefault' => false,
189 'position' => 2
190 ],
191 [
192 'id' => 9,
193 'label' => BackendStrings::getTemplateStrings()['m'],
194 'value' => 'm',
195 'isDefault' => false,
196 'position' => 3
197 ],
198 [
199 'id' => 10,
200 'label' => BackendStrings::getTemplateStrings()['l'],
201 'value' => 'l',
202 'isDefault' => false,
203 'position' => 4
204 ],
205 [
206 'id' => 11,
207 'label' => BackendStrings::getTemplateStrings()['xl'],
208 'value' => 'xl',
209 'isDefault' => false,
210 'position' => 5
211 ],
212 [
213 'id' => 12,
214 'label' => BackendStrings::getTemplateStrings()['xxl'],
215 'value' => 'xxl',
216 'isDefault' => false,
217 'position' => 6
218 ],
219 ]
220 ],
221 // Quantity
222 [
223 'id' => 14,
224 'fieldIndex' => 6,
225 'type' => 'number',
226 'label' => BackendStrings::getTemplateStrings()['quantity'],
227 'placeholder' => BackendStrings::getTemplateStrings()['enter_quantity'],
228 'required' => true,
229 'parentId' => null,
230 'position' => 6,
231 'minValue' => 1,
232 'maxValue' => 100,
233 ],
234 // Event Notes or Special Instructions
235 [
236 'id' => 15,
237 'fieldIndex' => 7,
238 'type' => 'textarea',
239 'label' => BackendStrings::getTemplateStrings()['event_notes_special_instructions'],
240 'placeholder' => BackendStrings::getTemplateStrings()['enter_event_notes'],
241 'parentId' => null,
242 'defaultValue' => '',
243 'position' => 7,
244 'required' => false,
245 'rows' => 3,
246 ],
247 // T-Shirt Color
248 [
249 'id' => 22,
250 'fieldIndex' => 8,
251 'type' => 'select',
252 'label' => BackendStrings::getTemplateStrings()['tshirt_color'],
253 'placeholder' => BackendStrings::getTemplateStrings()['select_tshirt_color'],
254 'required' => true,
255 'parentId' => null,
256 'defaultValue' => '',
257 'position' => 8,
258 'fieldOptions' => [
259 [
260 'id' => 16,
261 'label' => BackendStrings::getTemplateStrings()['white'],
262 'value' => 'white',
263 'isDefault' => false,
264 'position' => 1
265 ],
266 [
267 'id' => 17,
268 'label' => BackendStrings::getTemplateStrings()['black'],
269 'value' => 'black',
270 'isDefault' => false,
271 'position' => 2
272 ],
273 [
274 'id' => 18,
275 'label' => BackendStrings::getTemplateStrings()['red'],
276 'value' => 'red',
277 'isDefault' => false,
278 'position' => 3
279 ],
280 [
281 'id' => 19,
282 'label' => BackendStrings::getTemplateStrings()['blue'],
283 'value' => 'blue',
284 'isDefault' => false,
285 'position' => 4
286 ],
287 [
288 'id' => 20,
289 'label' => BackendStrings::getTemplateStrings()['green'],
290 'value' => 'green',
291 'isDefault' => false,
292 'position' => 5
293 ],
294 [
295 'id' => 21,
296 'label' => BackendStrings::getTemplateStrings()['custom'],
297 'value' => 'custom',
298 'isDefault' => false,
299 'position' => 6
300 ],
301 ]
302 ],
303 ];
304 }
305
306 /**
307 * Get additional options fields
308 *
309 * @return array<int, array<string, mixed>>
310 */
311 private static function getAdditionalOptionsFields(): array
312 {
313 return [
314 // Include Event Logo
315 [
316 'id' => 25,
317 'fieldIndex' => 9,
318 'type' => 'radio',
319 'label' => BackendStrings::getTemplateStrings()['include_event_logo'],
320 'parentId' => null,
321 'position' => 9,
322 'required' => false,
323 'fieldOptions' => [
324 [
325 'id' => 23,
326 'label' => BackendStrings::getTemplateStrings()['yes'],
327 'value' => 'yes',
328 'isDefault' => false,
329 'position' => 1
330 ],
331 [
332 'id' => 24,
333 'label' => BackendStrings::getTemplateStrings()['no'],
334 'value' => 'no',
335 'isDefault' => false,
336 'position' => 2
337 ],
338 ]
339 ],
340 // Event Date - moved to last position
341 [
342 'id' => 26,
343 'fieldIndex' => 10,
344 'type' => 'date',
345 'label' => BackendStrings::getTemplateStrings()['event_date'],
346 'placeholder' => BackendStrings::getTemplateStrings()['select_event_date'],
347 'required' => true,
348 'parentId' => null,
349 'defaultValue' => '',
350 'position' => 10,
351 'dateFieldType' => 'picker',
352 'dateFormat' => 'MM/DD/YYYY',
353 ],
354 ];
355 }
356 }
357