PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
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
← All changes | backend/src/Services/Template/DinnerReservationFormTemplate.php +38 -29 0.8.1 → 1.5 View file →
@@ -1,23 +1,18 @@
1 1 <?php
2 2
3 3 namespace IvyForms\Services\Template;
4 4
5 -// phpcs:disable PSR1.Files.SideEffects
6 -if (!defined('ABSPATH')) {
7 - exit; // Exit if accessed directly
8 -}
9 -
10 5 use IvyForms\Services\Translations\BackendStrings;
11 6
12 7 class DinnerReservationFormTemplate
13 8 {
14 9 /**
15 - * Get the dinner reservation form template
10 + * Get template metadata (without form_data)
16 11 *
17 12 * @return array<string, mixed>
18 13 */
19 - public static function getTemplate(): array
14 + public static function getTemplateMeta(): array
20 15 {
21 16 return [
22 17 'id' => 'dinner_reservation_form',
23 18 'name' => BackendStrings::getTemplateStrings()['dinner_reservation_form'],
@@ -24,9 +19,22 @@
24 19 'description' => BackendStrings::getTemplateStrings()['dinner_reservation_form_desc'],
25 20 'category' => 'booking-forms',
26 21 'subcategory' => 'reservation-forms',
27 22 'is_pro' => false,
28 - 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'dinner-reservation-form.svg',
23 + 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'dinner-reservation-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 + [
29 37 'form_data' => [
30 38 'name' => BackendStrings::getTemplateStrings()['dinner_reservation_form'],
31 39 'published' => 1,
32 40 'showTitle' => 1,
@@ -38,9 +46,10 @@
38 46 self::getAdditionalFields()
39 47 ),
40 48 'settings' => []
41 49 ]
42 - ];
50 + ]
51 + );
43 52 }
44 53
45 54 /**
46 55 * Guest information fields (name, email, phone)
@@ -51,9 +60,9 @@
51 60 {
52 61 return [
53 62 // Name Field - Parent
54 63 [
55 - 'id' => 0,
64 + 'id' => 1,
56 65 'fieldIndex' => 1,
57 66 'type' => 'name',
58 67 'label' => BackendStrings::getTemplateStrings()['full_name'],
59 68 'parentId' => null,
@@ -64,14 +73,14 @@
64 73 'position' => 1,
65 74 ],
66 75 // First Name - Child of Name Field
67 76 [
68 - 'id' => 0,
77 + 'id' => 2,
69 78 'type' => 'text',
70 79 'label' => BackendStrings::getTemplateStrings()['first_name'],
71 80 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
72 81 'required' => true,
73 - 'parentId' => 0,
82 + 'parentId' => 1,
74 83 'fieldIndex' => 1,
75 84 'defaultValue' => '',
76 85 'position' => 1,
77 86 'optionHide' => false,
@@ -79,14 +88,14 @@
79 88 'settings' => json_encode(['nameFieldType' => 'nameField1']),
80 89 ],
81 90 // Last Name - Child of Name Field
82 91 [
83 - 'id' => 0,
92 + 'id' => 3,
84 93 'type' => 'text',
85 94 'label' => BackendStrings::getTemplateStrings()['last_name'],
86 95 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
87 96 'required' => true,
88 - 'parentId' => 0,
97 + 'parentId' => 1,
89 98 'fieldIndex' => 1,
90 99 'defaultValue' => '',
91 100 'position' => 2,
92 101 'optionHide' => false,
@@ -94,9 +103,9 @@
94 103 'settings' => json_encode(['nameFieldType' => 'nameField2']),
95 104 ],
96 105 // Email Address
97 106 [
98 - 'id' => 0,
107 + 'id' => 4,
99 108 'fieldIndex' => 2,
100 109 'type' => 'email',
101 110 'label' => BackendStrings::getTemplateStrings()['email_address'],
102 111 'placeholder' => BackendStrings::getTemplateStrings()['email_placeholder'],
@@ -106,9 +115,9 @@
106 115 'position' => 2,
107 116 ],
108 117 // Phone Number
109 118 [
110 - 'id' => 0,
119 + 'id' => 5,
111 120 'fieldIndex' => 3,
112 121 'type' => 'phone',
113 122 'label' => BackendStrings::getTemplateStrings()['phone_number'],
114 123 'placeholder' => BackendStrings::getTemplateStrings()['phone_placeholder'],
@@ -130,9 +139,9 @@
130 139 {
131 140 return [
132 141 // Number of Guests
133 142 [
134 - 'id' => 0,
143 + 'id' => 6,
135 144 'fieldIndex' => 4,
136 145 'type' => 'number',
137 146 'label' => BackendStrings::getTemplateStrings()['number_of_guests'],
138 147 'placeholder' => BackendStrings::getTemplateStrings()['enter_total_guests'],
@@ -142,9 +151,9 @@
142 151 'position' => 4,
143 152 ],
144 153 // Seating Preference
145 154 [
146 - 'id' => 0,
155 + 'id' => 11,
147 156 'fieldIndex' => 5,
148 157 'type' => 'select',
149 158 'label' => BackendStrings::getTemplateStrings()['seating_preference'],
150 159 'placeholder' => BackendStrings::getTemplateStrings()['select_seating_preference'],
@@ -153,9 +162,9 @@
153 162 'defaultValue' => '',
154 163 'position' => 5,
155 164 'fieldOptions' => [
156 165 [
157 - 'id' => 0,
166 + 'id' => 7,
158 167 'label' => BackendStrings::getTemplateStrings()['indoor'],
159 168 'value' => 'indoor',
160 169 'isDefault' => false,
161 170 'position' => 1
@@ -160,9 +169,9 @@
160 169 'isDefault' => false,
161 170 'position' => 1
162 171 ],
163 172 [
164 - 'id' => 0,
173 + 'id' => 8,
165 174 'label' => BackendStrings::getTemplateStrings()['outdoor'],
166 175 'value' => 'outdoor',
167 176 'isDefault' => false,
168 177 'position' => 2
@@ -167,9 +176,9 @@
167 176 'isDefault' => false,
168 177 'position' => 2
169 178 ],
170 179 [
171 - 'id' => 0,
180 + 'id' => 9,
172 181 'label' => BackendStrings::getTemplateStrings()['private_room'],
173 182 'value' => 'private_room',
174 183 'isDefault' => false,
175 184 'position' => 3
@@ -174,9 +183,9 @@
174 183 'isDefault' => false,
175 184 'position' => 3
176 185 ],
177 186 [
178 - 'id' => 0,
187 + 'id' => 10,
179 188 'label' => BackendStrings::getTemplateStrings()['window_seat'],
180 189 'value' => 'window_seat',
181 190 'isDefault' => false,
182 191 'position' => 4],
@@ -183,9 +192,9 @@
183 192 ]
184 193 ],
185 194 // Reservation Date
186 195 [
187 - 'id' => 0,
196 + 'id' => 12,
188 197 'fieldIndex' => 6,
189 198 'type' => 'date',
190 199 'label' => BackendStrings::getTemplateStrings()['reservation_date'],
191 200 'placeholder' => BackendStrings::getTemplateStrings()['select_reservation_date'],
@@ -197,9 +206,9 @@
197 206 'dateFormat' => 'MM/DD/YYYY',
198 207 ],
199 208 // Reservation Time
200 209 [
201 - 'id' => 0,
210 + 'id' => 13,
202 211 'fieldIndex' => 7,
203 212 'type' => 'time',
204 213 'label' => BackendStrings::getTemplateStrings()['reservation_time'],
205 214 'placeholder' => BackendStrings::getTemplateStrings()['select_reservation_time'],
@@ -222,9 +231,9 @@
222 231 {
223 232 return [
224 233 // Special Requests
225 234 [
226 - 'id' => 0,
235 + 'id' => 14,
227 236 'fieldIndex' => 8,
228 237 'type' => 'textarea',
229 238 'label' => BackendStrings::getTemplateStrings()['special_requests'],
230 239 'placeholder' => BackendStrings::getTemplateStrings()['special_requests_placeholder'],
@@ -235,9 +244,9 @@
235 244 'rows' => 4,
236 245 ],
237 246 // Occasion
238 247 [
239 - 'id' => 0,
248 + 'id' => 18,
240 249 'fieldIndex' => 9,
241 250 'type' => 'checkbox',
242 251 'label' => BackendStrings::getTemplateStrings()['occasion_question'],
243 252 'parentId' => null,
@@ -246,9 +255,9 @@
246 255 'defaultValue' => '',
247 256 'placeholder' => '',
248 257 'fieldOptions' => [
249 258 [
250 - 'id' => 0,
259 + 'id' => 15,
251 260 'label' => BackendStrings::getTemplateStrings()['birthday'],
252 261 'value' => 'birthday',
253 262 'isDefault' => false,
254 263 'position' => 1
@@ -253,9 +262,9 @@
253 262 'isDefault' => false,
254 263 'position' => 1
255 264 ],
256 265 [
257 - 'id' => 0,
266 + 'id' => 16,
258 267 'label' => BackendStrings::getTemplateStrings()['anniversary'],
259 268 'value' => 'anniversary',
260 269 'isDefault' => false,
261 270 'position' => 2
@@ -260,9 +269,9 @@
260 269 'isDefault' => false,
261 270 'position' => 2
262 271 ],
263 272 [
264 - 'id' => 0,
273 + 'id' => 17,
265 274 'label' => BackendStrings::getTemplateStrings()['other'],
266 275 'value' => 'other',
267 276 'isDefault' => false,
268 277 'position' => 3