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
ivyforms / backend / src / Services / Template / WebsiteExperienceFeedbackFormTemplate.php

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

291 lines 9.3 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 WebsiteExperienceFeedbackFormTemplate
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' => 'website_experience_feedback_form',
18 'name' => BackendStrings::getTemplateStrings()['website_experience_feedback_form'],
19 'description' => BackendStrings::getTemplateStrings()['website_experience_feedback_form_desc'],
20 'category' => 'feedback-forms',
21 'subcategory' => 'customer-feedback-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'website-experience-feedback-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 [
37 'form_data' => [
38 'name' => BackendStrings::getTemplateStrings()['website_experience_feedback_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getWebsiteUrlField(),
45 self::getDeviceUsedField(),
46 self::getNavigationEaseRatingField(),
47 self::getVisualDesignRatingField(),
48 self::getIssuesEncounteredCheckboxField(),
49 self::getSuggestionsCommentsTextareaField()
50 ),
51 'settings' => []
52 ]
53 ]
54 );
55 }
56
57 /**
58 * Website / URL - Page URL (required)
59 *
60 * @return array<int, array<string, mixed>>
61 */
62 private static function getWebsiteUrlField(): array
63 {
64 return [[
65 'id' => 1,
66 'fieldIndex' => 1,
67 'type' => 'website',
68 'label' => BackendStrings::getTemplateStrings()['website_page_url'],
69 'placeholder' => BackendStrings::getTemplateStrings()['current_page_url'],
70 'required' => true,
71 'parentId' => null,
72 'defaultValue' => '',
73 'position' => 1,
74 ]];
75 }
76
77 /**
78 * Device used (dropdown, required)
79 *
80 * @return array<int, array<string, mixed>>
81 */
82 private static function getDeviceUsedField(): array
83 {
84 return [[
85 'id' => 6,
86 'fieldIndex' => 2,
87 'type' => 'select',
88 'label' => BackendStrings::getTemplateStrings()['device_used'],
89 'required' => true,
90 'parentId' => null,
91 'defaultValue' => '',
92 'placeholder' => BackendStrings::getTemplateStrings()['select_device_used'],
93 'position' => 2,
94 'fieldOptions' => [
95 [
96 'label' => BackendStrings::getTemplateStrings()['desktop'],
97 'value' => 'desktop',
98 'position' => 1,
99 ],
100 [
101 'label' => BackendStrings::getTemplateStrings()['laptop'],
102 'value' => 'laptop',
103 'position' => 2,
104 ],
105 [
106 'label' => BackendStrings::getTemplateStrings()['tablet'],
107 'value' => 'tablet',
108 'position' => 3,
109 ],
110 [
111 'label' => BackendStrings::getTemplateStrings()['mobile_phone'],
112 'value' => 'mobile_phone',
113 'position' => 4,
114 ],
115 ]
116 ]];
117 }
118
119 /**
120 * Ease of navigation rating (required)
121 *
122 * @return array<int, array<string, mixed>>
123 */
124 private static function getNavigationEaseRatingField(): array
125 {
126 return [[
127 'id' => 7,
128 'fieldIndex' => 3,
129 'type' => 'rating',
130 'label' => BackendStrings::getTemplateStrings()['ease_of_navigation'],
131 'required' => true,
132 'defaultValue' => '',
133 'placeholder' => '',
134 'position' => 3,
135 'labelPosition' => 'default',
136 'ratingIcon' => 'star',
137 'fieldOptions' => self::getStandardRatingOptions(1),
138 'showValues' => false,
139 'showRatingText' => true,
140 ]];
141 }
142
143 /**
144 * Visual design rating (required)
145 *
146 * @return array<int, array<string, mixed>>
147 */
148 private static function getVisualDesignRatingField(): array
149 {
150 return [[
151 'id' => 8,
152 'fieldIndex' => 4,
153 'type' => 'rating',
154 'label' => BackendStrings::getTemplateStrings()['visual_design'],
155 'required' => true,
156 'defaultValue' => '',
157 'placeholder' => '',
158 'position' => 4,
159 'labelPosition' => 'default',
160 'ratingIcon' => 'star',
161 'fieldOptions' => self::getStandardRatingOptions(6),
162 'showValues' => false,
163 'showRatingText' => true,
164 ]];
165 }
166
167 /**
168 * Issues encountered (checkbox, optional)
169 *
170 * @return array<int, array<string, mixed>>
171 */
172 private static function getIssuesEncounteredCheckboxField(): array
173 {
174 return [[
175 'id' => 14,
176 'fieldIndex' => 5,
177 'type' => 'checkbox',
178 'label' => BackendStrings::getTemplateStrings()['issues_encountered'],
179 'required' => false,
180 'parentId' => null,
181 'defaultValue' => '',
182 'placeholder' => '',
183 'position' => 5,
184 'fieldOptions' => [
185 [
186 'id' => 9,
187 'label' => BackendStrings::getTemplateStrings()['slow_loading'],
188 'value' => 'slow_loading',
189 'isDefault' => false,
190 'position' => 1,
191 ],
192 [
193 'id' => 10,
194 'label' => BackendStrings::getTemplateStrings()['broken_links'],
195 'value' => 'broken_links',
196 'isDefault' => false,
197 'position' => 2,
198 ],
199 [
200 'id' => 11,
201 'label' => BackendStrings::getTemplateStrings()['confusing_navigation'],
202 'value' => 'confusing_navigation',
203 'isDefault' => false,
204 'position' => 3,
205 ],
206 [
207 'id' => 12,
208 'label' => BackendStrings::getTemplateStrings()['layout_issues'],
209 'value' => 'layout_issues',
210 'isDefault' => false,
211 'position' => 4,
212 ],
213 [
214 'id' => 13,
215 'label' => BackendStrings::getTemplateStrings()['no_issues'],
216 'value' => 'no_issues',
217 'isDefault' => false,
218 'position' => 5,
219 ],
220 ]
221 ]];
222 }
223
224 /**
225 * Suggestions or comments (textarea, optional)
226 *
227 * @return array<int, array<string, mixed>>
228 */
229 private static function getSuggestionsCommentsTextareaField(): array
230 {
231 return [[
232 'id' => 15,
233 'fieldIndex' => 6,
234 'type' => 'textarea',
235 'label' => BackendStrings::getTemplateStrings()['suggestions_or_comments'],
236 'placeholder' => BackendStrings::getTemplateStrings()['suggestions_comments_placeholder'],
237 'required' => false,
238 'parentId' => null,
239 'defaultValue' => '',
240 'position' => 6,
241 'labelPosition' => 'default',
242 ]];
243 }
244
245 /**
246 * Standard rating options (1-5)
247 *
248 * @return array<int, array<string, mixed>>
249 */
250 private static function getStandardRatingOptions(int $startId): array
251 {
252 return [
253 [
254 'id' => $startId,
255 'label' => BackendStrings::getNewFormStrings()['good'],
256 'value' => '1',
257 'isDefault' => false,
258 'position' => 1
259 ],
260 [
261 'id' => $startId + 1,
262 'label' => BackendStrings::getNewFormStrings()['nice'],
263 'value' => '2',
264 'isDefault' => false,
265 'position' => 2
266 ],
267 [
268 'id' => $startId + 2,
269 'label' => BackendStrings::getNewFormStrings()['very_good'],
270 'value' => '3',
271 'isDefault' => false,
272 'position' => 3
273 ],
274 [
275 'id' => $startId + 3,
276 'label' => BackendStrings::getNewFormStrings()['awesome'],
277 'value' => '4',
278 'isDefault' => false,
279 'position' => 4
280 ],
281 [
282 'id' => $startId + 4,
283 'label' => BackendStrings::getNewFormStrings()['amazing'],
284 'value' => '5',
285 'isDefault' => false,
286 'position' => 5
287 ],
288 ];
289 }
290 }
291