PluginProbe
The Innovative Form Builder – IvyForms / 0.8.2
The Innovative Form Builder – IvyForms v0.8.2
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 / FoodVendorRegistrationFormTemplate.php

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

298 lines 10.7 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 FoodVendorRegistrationFormTemplate
13 {
14 /**
15 * Get the food vendor registration form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'food_vendor_registration_form',
23 'name' => BackendStrings::getTemplateStrings()['food_vendor_registration_form'],
24 'description' => BackendStrings::getTemplateStrings()[
25 'food_vendor_registration_form_desc'
26 ],
27 'category' => 'registration-forms',
28 'subcategory' => 'vendor-registration-forms',
29 'is_pro' => false,
30 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'food-vendor-registration-form.svg',
31 'form_data' => [
32 'name' => BackendStrings::getTemplateStrings()['food_vendor_registration_form'],
33 'published' => 1,
34 'showTitle' => 1,
35 'storeEntries' => 1,
36 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
37 'fields' => array_merge(
38 self::getVendorInformationFields(),
39 self::getProductDetailsFields(),
40 self::getBoothDetailsFields(),
41 self::getAdditionalFields()
42 ),
43 'settings' => []
44 ]
45 ];
46 }
47
48 /**
49 * Vendor information fields
50 *
51 * @return array<int, array<string, mixed>>
52 */
53 private static function getVendorInformationFields(): array
54 {
55 return [
56 // Business / Vendor Name
57 [
58 'id' => 0,
59 'fieldIndex' => 1,
60 'type' => 'text',
61 'label' => BackendStrings::getTemplateStrings()['business_vendor_name'],
62 'placeholder' => BackendStrings::getTemplateStrings()['enter_business_name'],
63 'required' => true,
64 'parentId' => null,
65 'defaultValue' => '',
66 'position' => 1,
67 ],
68 // Owner / Contact Person
69 [
70 'id' => 0,
71 'fieldIndex' => 2,
72 'type' => 'text',
73 'label' => BackendStrings::getTemplateStrings()['owner_contact_person'],
74 'placeholder' => BackendStrings::getTemplateStrings()['enter_owner_contact_name'],
75 'required' => true,
76 'parentId' => null,
77 'defaultValue' => '',
78 'position' => 2,
79 ],
80 // Email Address
81 [
82 'id' => 0,
83 'fieldIndex' => 3,
84 'type' => 'email',
85 'label' => BackendStrings::getTemplateStrings()['email_address'],
86 'placeholder' => BackendStrings::getTemplateStrings()['name_placeholder'],
87 'required' => true,
88 'parentId' => null,
89 'defaultValue' => '',
90 'position' => 3,
91 ],
92 // Phone Number (optional)
93 [
94 'id' => 0,
95 'fieldIndex' => 4,
96 'type' => 'phone',
97 'label' => BackendStrings::getTemplateStrings()['phone_number'],
98 'placeholder' => BackendStrings::getTemplateStrings()['phone_placeholder'],
99 'required' => false,
100 'parentId' => null,
101 'defaultValue' => '',
102 'position' => 4,
103 'phoneAutoDetect' => true,
104 ],
105 ];
106 }
107
108 /**
109 * Product details fields (food type, menu offerings)
110 *
111 * @return array<int, array<string, mixed>>
112 */
113 private static function getProductDetailsFields(): array
114 {
115 return [
116 // Food Type (select)
117 [
118 'id' => 0,
119 'fieldIndex' => 5,
120 'type' => 'select',
121 'label' => BackendStrings::getTemplateStrings()['food_type'],
122 'placeholder' => BackendStrings::getTemplateStrings()['select_food_type'],
123 'required' => true,
124 'parentId' => null,
125 'defaultValue' => '',
126 'position' => 5,
127 'fieldOptions' => [
128 [
129 'id' => 0,
130 'label' => BackendStrings::getTemplateStrings()['baked_goods'],
131 'value' => 'baked_goods',
132 'isDefault' => false,
133 'position' => 1
134 ],
135 [
136 'id' => 0,
137 'label' => BackendStrings::getTemplateStrings()['beverages'],
138 'value' => 'beverages',
139 'isDefault' => false,
140 'position' => 2
141 ],
142 [
143 'id' => 0,
144 'label' => BackendStrings::getTemplateStrings()['snacks'],
145 'value' => 'snacks',
146 'isDefault' => false,
147 'position' => 3
148 ],
149 [
150 'id' => 0,
151 'label' => BackendStrings::getTemplateStrings()['full_meals'],
152 'value' => 'full_meals',
153 'isDefault' => false,
154 'position' => 4
155 ],
156 [
157 'id' => 0,
158 'label' => BackendStrings::getTemplateStrings()['other'],
159 'value' => 'other',
160 'isDefault' => false,
161 'position' => 5
162 ],
163 ]
164 ],
165 // Menu Items / Offerings (required textarea)
166 [
167 'id' => 0,
168 'fieldIndex' => 6,
169 'type' => 'textarea',
170 'label' => BackendStrings::getTemplateStrings()['menu_items_offerings'],
171 'placeholder' => BackendStrings::getTemplateStrings()['list_main_products_or_menu'],
172 'parentId' => null,
173 'defaultValue' => '',
174 'position' => 6,
175 'required' => true,
176 'rows' => 4,
177 ],
178 ];
179 }
180
181 /**
182 * Booth details fields (size, electricity)
183 *
184 * @return array<int, array<string, mixed>>
185 */
186 private static function getBoothDetailsFields(): array
187 {
188 return [
189 // Booth / Stall Size Needed (number, optional)
190 [
191 'id' => 0,
192 'fieldIndex' => 7,
193 'type' => 'number',
194 'label' => BackendStrings::getTemplateStrings()['booth_stall_size_needed'],
195 'placeholder' => BackendStrings::getTemplateStrings()['enter_size_sq_meters'],
196 'required' => false,
197 'parentId' => null,
198 'defaultValue' => '',
199 'position' => 7,
200 ],
201 // Require Electricity? (radio, optional)
202 [
203 'id' => 0,
204 'fieldIndex' => 8,
205 'type' => 'radio',
206 'label' => BackendStrings::getTemplateStrings()['require_electricity'],
207 'parentId' => null,
208 'position' => 8,
209 'required' => false,
210 'defaultValue' => '',
211 'placeholder' => '',
212 'fieldOptions' => [
213 [
214 'id' => 0,
215 'label' => BackendStrings::getTemplateStrings()['yes'],
216 'value' => 'yes',
217 'isDefault' => false,
218 'position' => 1
219 ],
220 [
221 'id' => 0,
222 'label' => BackendStrings::getTemplateStrings()['no'],
223 'value' => 'no',
224 'isDefault' => false,
225 'position' => 2
226 ],
227 ],
228 ],
229 ];
230 }
231
232 /**
233 * Additional fields (special requirements, available dates, terms agreement)
234 *
235 * @return array<int, array<string, mixed>>
236 */
237 private static function getAdditionalFields(): array
238 {
239 return [
240 // Special Requirements (optional textarea)
241 [
242 'id' => 0,
243 'fieldIndex' => 9,
244 'type' => 'textarea',
245 'label' => BackendStrings::getTemplateStrings()['special_requirements'],
246 'placeholder' => BackendStrings::getTemplateStrings()['special_requirements_placeholder'],
247 'parentId' => null,
248 'defaultValue' => '',
249 'position' => 9,
250 'required' => false,
251 'rows' => 3,
252 ],
253 // Available Dates (date picker, required)
254 [
255 'id' => 0,
256 'fieldIndex' => 10,
257 'type' => 'date',
258 'label' => BackendStrings::getTemplateStrings()['available_date'],
259 'placeholder' => BackendStrings::getTemplateStrings()['select_available_date'],
260 'required' => true,
261 'parentId' => null,
262 'defaultValue' => '',
263 'position' => 10,
264 'dateFieldType' => 'picker',
265 'dateFormat' => 'MM/DD/YYYY',
266 ],
267 // Agree to Vendor Terms & Conditions (radio, required)
268 [
269 'id' => 0,
270 'fieldIndex' => 11,
271 'type' => 'radio',
272 'label' => BackendStrings::getTemplateStrings()['agree_vendor_terms_conditions'],
273 'parentId' => null,
274 'position' => 11,
275 'required' => true,
276 'defaultValue' => '',
277 'placeholder' => '',
278 'fieldOptions' => [
279 [
280 'id' => 0,
281 'label' => BackendStrings::getTemplateStrings()['yes'],
282 'value' => 'yes',
283 'isDefault' => false,
284 'position' => 1
285 ],
286 [
287 'id' => 0,
288 'label' => BackendStrings::getTemplateStrings()['no'],
289 'value' => 'no',
290 'isDefault' => false,
291 'position' => 2
292 ],
293 ],
294 ],
295 ];
296 }
297 }
298