PluginProbe
The Innovative Form Builder – IvyForms / 0.6
The Innovative Form Builder – IvyForms v0.6
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 0.6, at backend/src/Services/Template/BirthdayTShirtOrderFormTemplate.php

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