PluginProbe
The Innovative Form Builder – IvyForms / 1.4
The Innovative Form Builder – IvyForms v1.4
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 / BirthdayTShirtOrderFormTemplate.php

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

359 lines 12.6 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 BirthdayTShirtOrderFormTemplate
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' => 'birthday_tshirt_order_form',
18 'name' => BackendStrings::getTemplateStrings()['birthday_tshirt_order_form'],
19 'description' => BackendStrings::getTemplateStrings()['birthday_tshirt_order_form_desc'],
20 'category' => 'order-forms',
21 'subcategory' => 'tshirt-order-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'birthday-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()['birthday_tshirt_order_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getOrdererInformationFields(),
45 self::getBirthdayDetailsFields(),
46 self::getTShirtDetailsFields(),
47 self::getDeliveryDetailsFields()
48 ),
49 'settings' => []
50 ]
51 ]
52 );
53 }
54
55 /**
56 * Get orderer information fields
57 *
58 * @return array<int, array<string, mixed>>
59 */
60 private static function getOrdererInformationFields(): array
61 {
62 return [
63 // Name Field - Parent
64 [
65 'id' => 1,
66 'fieldIndex' => 1,
67 'type' => 'name',
68 'label' => BackendStrings::getTemplateStrings()['orderer_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' => '[email protected]',
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 birthday details fields
136 *
137 * @return array<int, array<string, mixed>>
138 */
139 private static function getBirthdayDetailsFields(): array
140 {
141 return [
142 // Birthday Person's Name
143 [
144 'id' => 6,
145 'fieldIndex' => 4,
146 'type' => 'text',
147 'label' => BackendStrings::getTemplateStrings()['birthday_person_name'],
148 'placeholder' => BackendStrings::getTemplateStrings()['enter_birthday_person_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' => 7,
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' => 8,
179 'label' => BackendStrings::getTemplateStrings()['xs'],
180 'value' => 'XS',
181 'position' => 1,
182 'isDefault' => false,
183 ],
184 [
185 'id' => 9,
186 'label' => BackendStrings::getTemplateStrings()['s'],
187 'value' => 'S',
188 'position' => 2,
189 'isDefault' => false,
190 ],
191 [
192 'id' => 10,
193 'label' => BackendStrings::getTemplateStrings()['m'],
194 'value' => 'M',
195 'position' => 3,
196 'isDefault' => false,
197 ],
198 [
199 'id' => 11,
200 'label' => BackendStrings::getTemplateStrings()['l'],
201 'value' => 'L',
202 'position' => 4,
203 'isDefault' => false,
204 ],
205 [
206 'id' => 12,
207 'label' => BackendStrings::getTemplateStrings()['xl'],
208 'value' => 'XL',
209 'position' => 5,
210 'isDefault' => false,
211 ],
212 [
213 'id' => 13,
214 'label' => BackendStrings::getTemplateStrings()['xxl'],
215 'value' => 'XXL',
216 'position' => 6,
217 'isDefault' => false,
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 // Message or Design Notes
235 [
236 'id' => 15,
237 'fieldIndex' => 7,
238 'type' => 'textarea',
239 'label' => BackendStrings::getTemplateStrings()['message_or_design_notes'],
240 'placeholder' => BackendStrings::getTemplateStrings()['add_birthday_message_or_design_details'],
241 'parentId' => null,
242 'defaultValue' => '',
243 'position' => 7,
244 'required' => false,
245 'rows' => 3,
246 ],
247 // T-Shirt Color
248 [
249 'id' => 16,
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' => 17,
261 'label' => BackendStrings::getTemplateStrings()['white'],
262 'value' => 'White',
263 'position' => 1,
264 'isDefault' => false,
265 ],
266 [
267 'id' => 18,
268 'label' => BackendStrings::getTemplateStrings()['black'],
269 'value' => 'Black',
270 'position' => 2,
271 'isDefault' => false,
272 ],
273 [
274 'id' => 19,
275 'label' => BackendStrings::getTemplateStrings()['red'],
276 'value' => 'Red',
277 'position' => 3,
278 'isDefault' => false,
279 ],
280 [
281 'id' => 20,
282 'label' => BackendStrings::getTemplateStrings()['blue'],
283 'value' => 'Blue',
284 'position' => 4,
285 'isDefault' => false,
286 ],
287 [
288 'id' => 21,
289 'label' => BackendStrings::getTemplateStrings()['green'],
290 'value' => 'Green',
291 'position' => 5,
292 'isDefault' => false,
293 ],
294 [
295 'id' => 22,
296 'label' => BackendStrings::getTemplateStrings()['custom'],
297 'value' => 'Custom',
298 'position' => 6,
299 'isDefault' => false,
300 ],
301 ]
302 ],
303 ];
304 }
305
306 /**
307 * Get delivery details fields
308 *
309 * @return array<int, array<string, mixed>>
310 */
311 private static function getDeliveryDetailsFields(): array
312 {
313 return [
314 // Include Gift Packaging
315 [
316 'id' => 23,
317 'fieldIndex' => 9,
318 'type' => 'radio',
319 'label' => BackendStrings::getTemplateStrings()['include_gift_packaging'],
320 'required' => false,
321 'parentId' => null,
322 'defaultValue' => '',
323 'placeholder' => '',
324 'position' => 9,
325 'fieldOptions' => [
326 [
327 'id' => 24,
328 'label' => BackendStrings::getTemplateStrings()['yes'],
329 'value' => 'Yes',
330 'position' => 1,
331 'isDefault' => false,
332 ],
333 [
334 'id' => 25,
335 'label' => BackendStrings::getTemplateStrings()['no'],
336 'value' => 'No',
337 'position' => 2,
338 'isDefault' => false,
339 ],
340 ]
341 ],
342 // Required Delivery Date
343 [
344 'id' => 26,
345 'fieldIndex' => 10,
346 'type' => 'date',
347 'label' => BackendStrings::getTemplateStrings()['required_delivery_date'],
348 'placeholder' => BackendStrings::getTemplateStrings()['select_delivery_date'],
349 'required' => true,
350 'parentId' => null,
351 'defaultValue' => '',
352 'position' => 10,
353 'dateFieldType' => 'picker',
354 'dateFormat' => 'MM/DD/YYYY',
355 ],
356 ];
357 }
358 }
359