PluginProbe
The Innovative Form Builder – IvyForms / 0.9.1
The Innovative Form Builder – IvyForms v0.9.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 / TeamTshirtOrderFormTemplate.php

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

339 lines 12.2 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 TeamTshirtOrderFormTemplate
13 {
14 /**
15 * Get the team t-shirt order form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'team_tshirt_order_form',
23 'name' => BackendStrings::getTemplateStrings()['team_tshirt_order_form'],
24 'description' => BackendStrings::getTemplateStrings()['team_tshirt_order_form_desc'],
25 'category' => 'order-forms',
26 'subcategory' => 'tshirt-order-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'team-tshirt-order-form.svg',
29 'form_data' => [
30 'name' => BackendStrings::getTemplateStrings()['team_tshirt_order_form'],
31 'published' => 1,
32 'showTitle' => 1,
33 'storeEntries' => 1,
34 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
35 'fields' => array_merge(
36 self::getContactInformationFields(),
37 self::getOrderDetailsFields(),
38 self::getAdditionalInformationFields()
39 ),
40 'settings' => []
41 ]
42 ];
43 }
44
45 /**
46 * Get contact information fields
47 *
48 * @return array<int, array<string, mixed>>
49 */
50 private static function getContactInformationFields(): array
51 {
52 return [
53 // Team Contact Name
54 [
55 'id' => 1,
56 'fieldIndex' => 1,
57 'type' => 'name',
58 'label' => BackendStrings::getTemplateStrings()['team_contact_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' => 2,
69 'type' => 'text',
70 'label' => BackendStrings::getNewFormStrings()['first_name'],
71 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_name'],
72 'required' => true,
73 'parentId' => 1,
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' => 3,
84 'type' => 'text',
85 'label' => BackendStrings::getNewFormStrings()['last_name'],
86 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
87 'required' => true,
88 'parentId' => 1,
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' => 4,
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 'validation' => [
108 'required' => true,
109 'email' => true
110 ],
111 ],
112 // Phone Number
113 [
114 'id' => 5,
115 'fieldIndex' => 3,
116 'type' => 'phone',
117 'label' => BackendStrings::getTemplateStrings()['phone_number'],
118 'placeholder' => '+1 (_) _-_',
119 'required' => false,
120 'parentId' => null,
121 'defaultValue' => '',
122 'position' => 3,
123 'phoneAutoDetect' => true,
124 ],
125 // Team Name
126 [
127 'id' => 6,
128 'fieldIndex' => 4,
129 'type' => 'text',
130 'label' => BackendStrings::getTemplateStrings()['team_name'],
131 'placeholder' => BackendStrings::getTemplateStrings()['enter_team_name'],
132 'required' => true,
133 'parentId' => null,
134 'defaultValue' => '',
135 'position' => 4,
136 ],
137 ];
138 }
139
140 /**
141 * Get order details fields
142 *
143 * @return array<int, array<string, mixed>>
144 */
145 private static function getOrderDetailsFields(): array
146 {
147 return [
148 // T-Shirt Size(s) Dropdown
149 [
150 'id' => 13,
151 'fieldIndex' => 5,
152 'type' => 'select',
153 'label' => BackendStrings::getTemplateStrings()['tshirt_sizes'],
154 'placeholder' => BackendStrings::getTemplateStrings()['select_tshirt_size'],
155 'required' => true,
156 'parentId' => null,
157 'defaultValue' => '',
158 'position' => 5,
159 'fieldOptions' => [
160 [
161 'id' => 7,
162 'label' => BackendStrings::getTemplateStrings()['xs'],
163 'value' => 'xs',
164 'isDefault' => false,
165 'position' => 1,
166 ],
167 [
168 'id' => 8,
169 'label' => BackendStrings::getTemplateStrings()['s'],
170 'value' => 's',
171 'isDefault' => false,
172 'position' => 2,
173 ],
174 [
175 'id' => 9,
176 'label' => BackendStrings::getTemplateStrings()['m'],
177 'value' => 'm',
178 'isDefault' => false,
179 'position' => 3,
180 ],
181 [
182 'id' => 10,
183 'label' => BackendStrings::getTemplateStrings()['l'],
184 'value' => 'l',
185 'isDefault' => false,
186 'position' => 4,
187 ],
188 [
189 'id' => 11,
190 'label' => BackendStrings::getTemplateStrings()['xl'],
191 'value' => 'xl',
192 'isDefault' => false,
193 'position' => 5,
194 ],
195 [
196 'id' => 12,
197 'label' => BackendStrings::getTemplateStrings()['xxl'],
198 'value' => 'xxl',
199 'isDefault' => false,
200 'position' => 6,
201 ],
202 ],
203 ],
204 // Quantity per Size
205 [
206 'id' => 14,
207 'fieldIndex' => 6,
208 'type' => 'number',
209 'label' => BackendStrings::getTemplateStrings()['quantity_per_size'],
210 'placeholder' => BackendStrings::getTemplateStrings()['enter_quantity'],
211 'required' => true,
212 'parentId' => null,
213 'defaultValue' => '',
214 'position' => 6,
215 ],
216 // Design Instructions
217 [
218 'id' => 15,
219 'fieldIndex' => 7,
220 'type' => 'textarea',
221 'label' => BackendStrings::getTemplateStrings()['design_instructions'],
222 'placeholder' => BackendStrings::getTemplateStrings()['enter_design_instructions'],
223 'required' => false,
224 'parentId' => null,
225 'defaultValue' => '',
226 'position' => 7,
227 'rows' => 4,
228 ],
229 // T-Shirt Color Dropdown
230 [
231 'id' => 22,
232 'fieldIndex' => 8,
233 'type' => 'select',
234 'label' => BackendStrings::getTemplateStrings()['tshirt_color'],
235 'placeholder' => BackendStrings::getTemplateStrings()['select_tshirt_color'],
236 'required' => true,
237 'parentId' => null,
238 'defaultValue' => '',
239 'position' => 8,
240 'fieldOptions' => [
241 [
242 'id' => 16,
243 'label' => BackendStrings::getTemplateStrings()['white'],
244 'value' => 'white',
245 'isDefault' => false,
246 'position' => 1,
247 ],
248 [
249 'id' => 17,
250 'label' => BackendStrings::getTemplateStrings()['black'],
251 'value' => 'black',
252 'isDefault' => false,
253 'position' => 2,
254 ],
255 [
256 'id' => 18,
257 'label' => BackendStrings::getTemplateStrings()['red'],
258 'value' => 'red',
259 'isDefault' => false,
260 'position' => 3,
261 ],
262 [
263 'id' => 19,
264 'label' => BackendStrings::getTemplateStrings()['blue'],
265 'value' => 'blue',
266 'isDefault' => false,
267 'position' => 4,
268 ],
269 [
270 'id' => 20,
271 'label' => BackendStrings::getTemplateStrings()['green'],
272 'value' => 'green',
273 'isDefault' => false,
274 'position' => 5,
275 ],
276 [
277 'id' => 21,
278 'label' => BackendStrings::getTemplateStrings()['custom'],
279 'value' => 'custom',
280 'isDefault' => false,
281 'position' => 6,
282 ],
283 ],
284 ],
285 ];
286 }
287
288 /**
289 * Get additional information fields
290 *
291 * @return array<int, array<string, mixed>>
292 */
293 private static function getAdditionalInformationFields(): array
294 {
295 return [
296 // Include Team Logo? Radio
297 [
298 'id' => 25,
299 'fieldIndex' => 9,
300 'type' => 'radio',
301 'label' => BackendStrings::getTemplateStrings()['include_team_logo'],
302 'placeholder' => '',
303 'required' => false,
304 'parentId' => null,
305 'defaultValue' => '',
306 'position' => 9,
307 'fieldOptions' => [
308 [
309 'id' => 23,
310 'label' => BackendStrings::getTemplateStrings()['yes'],
311 'value' => 'yes',
312 'isDefault' => false,
313 'position' => 1,
314 ],
315 [
316 'id' => 24,
317 'label' => BackendStrings::getTemplateStrings()['no'],
318 'value' => 'no',
319 'isDefault' => false,
320 'position' => 2,
321 ],
322 ],
323 ],
324 // Required Delivery Date
325 [
326 'id' => 26,
327 'fieldIndex' => 10,
328 'type' => 'date',
329 'label' => BackendStrings::getTemplateStrings()['required_delivery_date'],
330 'placeholder' => BackendStrings::getTemplateStrings()['select_required_delivery_date'],
331 'required' => true,
332 'parentId' => null,
333 'defaultValue' => '',
334 'position' => 10,
335 ],
336 ];
337 }
338 }
339