PluginProbe
The Innovative Form Builder – IvyForms / 1.0
The Innovative Form Builder – IvyForms v1.0
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 / CraftVendorRegistrationFormTemplate.php

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

329 lines 11.1 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 CraftVendorRegistrationFormTemplate
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' => 'craft_vendor_registration_form',
18 'name' => BackendStrings::getTemplateStrings()['craft_vendor_registration_form'],
19 'description' => BackendStrings::getTemplateStrings()[
20 'craft_vendor_registration_form_desc'
21 ],
22 'category' => 'registration-forms',
23 'subcategory' => 'vendor-registration-forms',
24 'is_pro' => false,
25 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'craft-vendor-registration-form.svg'
26 ];
27 }
28
29 /**
30 * Get the full template including form data
31 *
32 * @return array<string, mixed>
33 */
34 public static function getTemplate(): array
35 {
36 return array_merge(
37 self::getTemplateMeta(),
38 [
39 'form_data' => [
40 'name' => BackendStrings::getTemplateStrings()['craft_vendor_registration_form'],
41 'published' => 1,
42 'showTitle' => 1,
43 'storeEntries' => 1,
44 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
45 'fields' => array_merge(
46 self::getVendorInformationFields(),
47 self::getProductDetailsFields(),
48 self::getBoothDetailsFields(),
49 self::getAdditionalFields()
50 ),
51 'settings' => []
52 ]
53 ]
54 );
55 }
56
57 /**
58 * Vendor information fields (business name, contact, email, phone)
59 *
60 * @return array<int, array<string, mixed>>
61 */
62 private static function getVendorInformationFields(): array
63 {
64 return [
65 // Business / Vendor Name
66 [
67 'id' => 1,
68 'fieldIndex' => 1,
69 'type' => 'text',
70 'label' => BackendStrings::getTemplateStrings()['business_vendor_name'],
71 'placeholder' => BackendStrings::getTemplateStrings()[
72 'enter_business_name'
73 ],
74 'required' => true,
75 'parentId' => null,
76 'defaultValue' => '',
77 'position' => 1,
78 ],
79 // Owner / Contact Person
80 [
81 'id' => 2,
82 'fieldIndex' => 2,
83 'type' => 'text',
84 'label' => BackendStrings::getTemplateStrings()['owner_contact_person'],
85 'placeholder' => BackendStrings::getTemplateStrings()[
86 'enter_owner_contact_name'
87 ],
88 'required' => true,
89 'parentId' => null,
90 'defaultValue' => '',
91 'position' => 2,
92 ],
93 // Email Address
94 [
95 'id' => 3,
96 'fieldIndex' => 3,
97 'type' => 'email',
98 'label' => BackendStrings::getTemplateStrings()['email_address'],
99 'placeholder' => BackendStrings::getTemplateStrings()['name_placeholder'],
100 'required' => true,
101 'parentId' => null,
102 'defaultValue' => '',
103 'position' => 3,
104 ],
105 // Phone Number
106 [
107 'id' => 4,
108 'fieldIndex' => 4,
109 'type' => 'phone',
110 'label' => BackendStrings::getTemplateStrings()['phone_number'],
111 'placeholder' => BackendStrings::getTemplateStrings()[
112 'phone_placeholder'
113 ],
114 'required' => false,
115 'parentId' => null,
116 'defaultValue' => '',
117 'position' => 4,
118 'phoneAutoDetect' => true,
119 ],
120 ];
121 }
122
123 /**
124 * Product details fields (craft type, products description)
125 *
126 * @return array<int, array<string, mixed>>
127 */
128 private static function getProductDetailsFields(): array
129 {
130 return [
131 // Craft Type
132 [
133 'id' => 10,
134 'fieldIndex' => 5,
135 'type' => 'select',
136 'label' => BackendStrings::getTemplateStrings()['craft_type'],
137 'placeholder' => BackendStrings::getTemplateStrings()[
138 'select_craft_type'
139 ],
140 'required' => true,
141 'parentId' => null,
142 'defaultValue' => '',
143 'position' => 5,
144 'fieldOptions' => [
145 [
146 'id' => 5,
147 'label' => BackendStrings::getTemplateStrings()['jewelry'],
148 'value' => 'jewelry',
149 'isDefault' => false,
150 'position' => 1
151 ],
152 [
153 'id' => 6,
154 'label' => BackendStrings::getTemplateStrings()['pottery'],
155 'value' => 'pottery',
156 'isDefault' => false,
157 'position' => 2
158 ],
159 [
160 'id' => 7,
161 'label' => BackendStrings::getTemplateStrings()['textiles'],
162 'value' => 'textiles',
163 'isDefault' => false,
164 'position' => 3
165 ],
166 [
167 'id' => 8,
168 'label' => BackendStrings::getTemplateStrings()['woodwork'],
169 'value' => 'woodwork',
170 'isDefault' => false,
171 'position' => 4
172 ],
173 [
174 'id' => 9,
175 'label' => BackendStrings::getTemplateStrings()['other'],
176 'value' => 'other',
177 'isDefault' => false,
178 'position' => 5
179 ],
180 ]
181 ],
182 // Products / Description
183 [
184 'id' => 11,
185 'fieldIndex' => 6,
186 'type' => 'textarea',
187 'label' => BackendStrings::getTemplateStrings()['products_description'],
188 'placeholder' => BackendStrings::getTemplateStrings()[
189 'describe_your_items'
190 ],
191 'parentId' => null,
192 'defaultValue' => '',
193 'position' => 6,
194 'required' => true,
195 'rows' => 4,
196 ],
197 ];
198 }
199
200 /**
201 * Booth details fields (space size, electricity needed)
202 *
203 * @return array<int, array<string, mixed>>
204 */
205 private static function getBoothDetailsFields(): array
206 {
207 return [
208 // Booth / Space Size Required
209 [
210 'id' => 12,
211 'fieldIndex' => 7,
212 'type' => 'number',
213 'label' => BackendStrings::getTemplateStrings()[
214 'booth_space_size_required'
215 ],
216 'placeholder' => BackendStrings::getTemplateStrings()[
217 'enter_space_size'
218 ],
219 'required' => false,
220 'parentId' => null,
221 'defaultValue' => '',
222 'position' => 7,
223 ],
224 // Need Electricity
225 [
226 'id' => 15,
227 'fieldIndex' => 8,
228 'type' => 'radio',
229 'label' => BackendStrings::getTemplateStrings()['need_electricity'],
230 'parentId' => null,
231 'position' => 8,
232 'required' => false,
233 'defaultValue' => '',
234 'placeholder' => '',
235 'fieldOptions' => [
236 [
237 'id' => 13,
238 'label' => BackendStrings::getTemplateStrings()['yes'],
239 'value' => 'yes',
240 'isDefault' => false,
241 'position' => 1
242 ],
243 [
244 'id' => 14,
245 'label' => BackendStrings::getTemplateStrings()['no'],
246 'value' => 'no',
247 'isDefault' => false,
248 'position' => 2
249 ],
250 ],
251 ],
252 ];
253 }
254
255 /**
256 * Additional fields (notes, available dates, vendor rules agreement)
257 *
258 * @return array<int, array<string, mixed>>
259 */
260 private static function getAdditionalFields(): array
261 {
262 return [
263 // Additional Notes / Requests
264 [
265 'id' => 16,
266 'fieldIndex' => 9,
267 'type' => 'textarea',
268 'label' => BackendStrings::getTemplateStrings()[
269 'additional_notes_requests'
270 ],
271 'placeholder' => BackendStrings::getTemplateStrings()[
272 'vendor_additional_notes_placeholder'
273 ],
274 'parentId' => null,
275 'defaultValue' => '',
276 'position' => 9,
277 'required' => false,
278 'rows' => 3,
279 ],
280 // Available Dates
281 [
282 'id' => 17,
283 'fieldIndex' => 10,
284 'type' => 'date',
285 'label' => BackendStrings::getTemplateStrings()['available_date'],
286 'placeholder' => BackendStrings::getTemplateStrings()[
287 'select_available_date'
288 ],
289 'required' => true,
290 'parentId' => null,
291 'defaultValue' => '',
292 'position' => 10,
293 'dateFieldType' => 'picker',
294 'dateFormat' => 'MM/DD/YYYY',
295 ],
296 // Agree to Vendor Rules & Policies
297 [
298 'id' => 20,
299 'fieldIndex' => 11,
300 'type' => 'radio',
301 'label' => BackendStrings::getTemplateStrings()[
302 'agree_vendor_rules_policies'
303 ],
304 'parentId' => null,
305 'position' => 11,
306 'required' => true,
307 'defaultValue' => '',
308 'placeholder' => '',
309 'fieldOptions' => [
310 [
311 'id' => 18,
312 'label' => BackendStrings::getTemplateStrings()['yes'],
313 'value' => 'yes',
314 'isDefault' => false,
315 'position' => 1
316 ],
317 [
318 'id' => 19,
319 'label' => BackendStrings::getTemplateStrings()['no'],
320 'value' => 'no',
321 'isDefault' => false,
322 'position' => 2
323 ],
324 ],
325 ],
326 ];
327 }
328 }
329