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 / NetworkingEventFeedbackFormTemplate.php

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

299 lines 9.9 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 NetworkingEventFeedbackFormTemplate
13 {
14 /**
15 * Get the Networking Event Feedback Form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'networking_event_feedback_form',
23 'name' => BackendStrings::getTemplateStrings()['networking_event_feedback_form'],
24 'description' => BackendStrings::getTemplateStrings()['networking_event_feedback_form_desc'],
25 'category' => 'feedback-forms',
26 'subcategory' => 'event-feedback-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'networking-event-feedback-form.svg',
29 'form_data' => [
30 'name' => BackendStrings::getTemplateStrings()['networking_event_feedback_form'],
31 'published' => 1,
32 'showTitle' => 1,
33 'storeEntries' => 1,
34 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
35 'fields' => array_merge(
36 self::getConnectionsRadioField(),
37 self::getNetworkingValueRatingField(),
38 self::getWhatHelpedCheckboxField(),
39 self::getImprovementTextareaField(),
40 self::getNameField()
41 ),
42 'settings' => []
43 ]
44 ];
45 }
46
47 /**
48 * Radio: Did you make valuable connections?
49 *
50 * @return array<int, array<string, mixed>>
51 */
52 private static function getConnectionsRadioField(): array
53 {
54 return [[
55 'id' => 5,
56 'fieldIndex' => 1,
57 'type' => 'radio',
58 'label' => BackendStrings::getTemplateStrings()['did_make_valuable_connections'],
59 'required' => true,
60 'parentId' => null,
61 'defaultValue' => '',
62 'placeholder' => '',
63 'position' => 1,
64 'fieldOptions' => [
65 [
66 'id' => 1,
67 'label' => BackendStrings::getTemplateStrings()['yes_many'],
68 'value' => 'yes_many',
69 'isDefault' => false,
70 'position' => 1
71 ],
72 [
73 'id' => 2,
74 'label' => BackendStrings::getTemplateStrings()['yes_a_few'],
75 'value' => 'yes_few',
76 'isDefault' => false,
77 'position' => 2
78 ],
79 [
80 'id' => 3,
81 'label' => BackendStrings::getTemplateStrings()['not_really'],
82 'value' => 'not_really',
83 'isDefault' => false,
84 'position' => 3
85 ],
86 [
87 'id' => 4,
88 'label' => BackendStrings::getTemplateStrings()['no_connections'],
89 'value' => 'no',
90 'isDefault' => false,
91 'position' => 4
92 ],
93 ]
94 ]];
95 }
96
97 /**
98 * Rating: Networking value
99 *
100 * @return array<int, array<string, mixed>>
101 */
102 private static function getNetworkingValueRatingField(): array
103 {
104 return [[
105 'id' => 6,
106 'fieldIndex' => 2,
107 'type' => 'rating',
108 'label' => BackendStrings::getTemplateStrings()['networking_value'],
109 'required' => true,
110 'defaultValue' => '',
111 'placeholder' => '',
112 'position' => 2,
113 'labelPosition' => 'default',
114 'ratingIcon' => 'star',
115 'fieldOptions' => self::getStandardRatingOptions(5),
116 'showValues' => false,
117 'showRatingText' => true,
118 ]];
119 }
120
121 /**
122 * Checkbox: What helped with networking?
123 *
124 * @return array<int, array<string, mixed>>
125 */
126 private static function getWhatHelpedCheckboxField(): array
127 {
128 return [[
129 'id' => 12,
130 'fieldIndex' => 3,
131 'type' => 'checkbox',
132 'label' => BackendStrings::getTemplateStrings()['what_helped_with_networking'],
133 'required' => false,
134 'parentId' => null,
135 'defaultValue' => '',
136 'placeholder' => '',
137 'position' => 3,
138 'fieldOptions' => [
139 [
140 'id' => 7,
141 'label' => BackendStrings::getTemplateStrings()['event_format'],
142 'value' => 'event_format',
143 'isDefault' => false,
144 'position' => 1
145 ],
146 [
147 'id' => 8,
148 'label' => BackendStrings::getTemplateStrings()['attendee_quality'],
149 'value' => 'attendee_quality',
150 'isDefault' => false,
151 'position' => 2
152 ],
153 [
154 'id' => 9,
155 'label' => BackendStrings::getTemplateStrings()['structured_activities'],
156 'value' => 'structured_activities',
157 'isDefault' => false,
158 'position' => 3
159 ],
160 [
161 'id' => 10,
162 'label' => BackendStrings::getTemplateStrings()['open_networking_time'],
163 'value' => 'open_networking_time',
164 'isDefault' => false,
165 'position' => 4
166 ],
167 [
168 'id' => 11,
169 'label' => BackendStrings::getTemplateStrings()['venue_or_atmosphere'],
170 'value' => 'venue_atmosphere',
171 'isDefault' => false,
172 'position' => 5
173 ],
174 ]
175 ]];
176 }
177
178 /**
179 * Paragraph: How could networking be improved?
180 *
181 * @return array<int, array<string, mixed>>
182 */
183 private static function getImprovementTextareaField(): array
184 {
185 return [[
186 'id' => 13,
187 'fieldIndex' => 4,
188 'type' => 'textarea',
189 'label' => BackendStrings::getTemplateStrings()['how_could_networking_be_improved'],
190 'placeholder' => BackendStrings::getTemplateStrings()['share_suggestions_to_improve_networking'],
191 'required' => false,
192 'parentId' => null,
193 'defaultValue' => '',
194 'position' => 4,
195 'labelPosition' => 'default',
196 ]];
197 }
198
199 /**
200 * Name field (optional)
201 *
202 * @return array<int, array<string, mixed>>
203 */
204 private static function getNameField(): array
205 {
206 return [
207 // Parent Name field
208 [
209 'id' => 14,
210 'fieldIndex' => 5,
211 'type' => 'name',
212 'label' => BackendStrings::getTemplateStrings()['full_name'],
213 'parentId' => null,
214 'defaultValue' => '',
215 'placeholder' => '',
216 'required' => false,
217 'readonly' => false,
218 'position' => 5,
219 ],
220 // First name - child
221 [
222 'id' => 15,
223 'type' => 'text',
224 'label' => BackendStrings::getNewFormStrings()['first_name'],
225 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
226 'required' => false,
227 'parentId' => 5,
228 'fieldIndex' => 5,
229 'defaultValue' => '',
230 'position' => 1,
231 'optionHide' => false,
232 'description' => '',
233 'settings' => json_encode(['nameFieldType' => 'nameField1']),
234 ],
235 // Last name - child
236 [
237 'id' => 16,
238 'type' => 'text',
239 'label' => BackendStrings::getNewFormStrings()['last_name'],
240 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
241 'required' => false,
242 'parentId' => 5,
243 'fieldIndex' => 5,
244 'defaultValue' => '',
245 'position' => 2,
246 'optionHide' => false,
247 'description' => '',
248 'settings' => json_encode(['nameFieldType' => 'nameField2']),
249 ],
250 ];
251 }
252
253 /**
254 * Standard rating options (1-5)
255 *
256 * @return array<int, array<string, mixed>>
257 */
258 private static function getStandardRatingOptions(int $startId): array
259 {
260 return [
261 [
262 'id' => $startId,
263 'label' => BackendStrings::getNewFormStrings()['good'],
264 'value' => '1',
265 'isDefault' => false,
266 'position' => 1
267 ],
268 [
269 'id' => $startId + 1,
270 'label' => BackendStrings::getNewFormStrings()['nice'],
271 'value' => '2',
272 'isDefault' => false,
273 'position' => 2
274 ],
275 [
276 'id' => $startId + 2,
277 'label' => BackendStrings::getNewFormStrings()['very_good'],
278 'value' => '3',
279 'isDefault' => false,
280 'position' => 3
281 ],
282 [
283 'id' => $startId + 3,
284 'label' => BackendStrings::getNewFormStrings()['awesome'],
285 'value' => '4',
286 'isDefault' => false,
287 'position' => 4
288 ],
289 [
290 'id' => $startId + 4,
291 'label' => BackendStrings::getNewFormStrings()['amazing'],
292 'value' => '5',
293 'isDefault' => false,
294 'position' => 5
295 ],
296 ];
297 }
298 }
299