PluginProbe
The Innovative Form Builder – IvyForms / 0.9
The Innovative Form Builder – IvyForms v0.9
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 0.9, at backend/src/Services/Template/WebsiteExperienceFeedbackFormTemplate.php

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