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

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