PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.5.3
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.5.3
4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 All 202 releases
betterdocs / includes / Editors / Elementor / Widget / Feedback.php

Feedback.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 3.5.3, at includes/Editors/Elementor/Widget/Feedback.php

434 lines 14.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WPDeveloper\BetterDocs\Editors\Elementor\Widget;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly
6 }
7
8 use Elementor\Widget_Base;
9 use Elementor\Controls_Manager;
10 use Elementor\Group_Control_Typography;
11 use Elementor\Plugin;
12
13 class Feedback extends Widget_Base {
14
15 public function get_name() {
16 return 'betterdocs-feedback';
17 }
18
19 public function get_title() {
20 return __( 'Doc Feedback', 'betterdocs' );
21 }
22
23 public function get_icon() {
24 return 'betterdocs-icon-feedback';
25 }
26
27 public function get_categories() {
28 return ['betterdocs-elements-single'];
29 }
30
31 public function get_keywords() {
32 return ['betterdocs-elements', 'feedback', 'betterdocs', 'docs'];
33 }
34
35 public function get_style_depends() {
36 return ['betterdocs-feedback-form'];
37 }
38
39 public function get_custom_help_url() {
40 return 'https://betterdocs.co/docs/single-doc-in-elementor';
41 }
42
43 protected function register_controls() {
44
45 /**
46 * ----------------------------------------------------------
47 * Section: Layout Options
48 * ----------------------------------------------------------
49 */
50 $this->start_controls_section(
51 'section_layout_options',
52 [
53 'label' => __( 'General ', 'betterdocs' )
54 ]
55 );
56
57 $this->add_control(
58 'feedback_link_title',
59 [
60 'label' => __( 'Content', 'betterdocs' ),
61 'type' => Controls_Manager::TEXT,
62 'default' => esc_html__( 'Still stuck? How can we help?', 'betterdocs' )
63 ]
64 );
65 $this->add_control(
66 'feedback_form_title',
67 [
68 'label' => __( 'Feedback Form Title', 'betterdocs' ),
69 'type' => Controls_Manager::TEXT,
70 'default' => esc_html__( 'How can we help?', 'betterdocs' )
71 ]
72 );
73
74 $this->add_control(
75 'feedback_form_button_text',
76 [
77 'label' => __( 'Button Text', 'betterdocs' ),
78 'type' => Controls_Manager::TEXT,
79 'default' => 'Send',
80 'placeholder' => __( 'Enter button text', 'betterdocs' ),
81 'title' => __( 'Enter button text here', 'betterdocs' )
82 ]
83 );
84
85 $this->end_controls_section();
86
87 $this->start_controls_section(
88 'section_card_settings_text',
89 [
90 'label' => __( 'Text', 'betterdocs' ),
91 'tab' => Controls_Manager::TAB_STYLE
92 ]
93 );
94
95 $this->add_control(
96 'feedback_text_color',
97 [
98 'label' => esc_html__( 'Color', 'betterdocs' ),
99 'type' => Controls_Manager::COLOR,
100 'selectors' => [
101 '{{WRAPPER}} .feedback-form-link' => 'color: {{VALUE}};'
102 ]
103 ]
104 );
105
106 $this->add_group_control(
107 Group_Control_Typography::get_type(),
108 [
109 'name' => 'feedback_text_typography',
110 'selector' => '{{WRAPPER}} .feedback-form-link'
111 ]
112 );
113
114 $this->end_controls_section();
115
116 $this->icon_section();
117
118 $this->feedback_form();
119 }
120
121 public function icon_section() {
122 $this->start_controls_section(
123 'section_icon_options',
124 [
125 'label' => __( 'Icon ', 'betterdocs' ),
126 'tab' => Controls_Manager::TAB_STYLE
127 ]
128 );
129
130 $this->add_control(
131 'feedback_icon_color',
132 [
133 'label' => esc_html__( 'Color', 'betterdocs' ),
134 'type' => Controls_Manager::COLOR
135 ]
136 );
137
138 $this->add_control(
139 'feedback_text_icon_size',
140 [
141 'label' => __( 'Size', 'betterdocs' ),
142 'type' => Controls_Manager::SLIDER,
143 'size_units' => ['px'],
144 'range' => [
145 'px' => [
146 'max' => 1000,
147 'step' => 1
148 ]
149 ],
150 'selectors' => [
151 '{{WRAPPER}} .feedback-form-icon svg' => 'width: {{SIZE}}px;height: {{SIZE}}px;'
152 ]
153 ]
154 );
155
156 $this->end_controls_section();
157 }
158
159 public function feedback_form() {
160 /**
161 * ----------------------------------------------------------
162 * Section: Box Styles
163 * ----------------------------------------------------------
164 */
165 $this->start_controls_section(
166 'section_card_settings',
167 [
168 'label' => __( 'FeedBack Form', 'betterdocs' ),
169 'tab' => Controls_Manager::TAB_STYLE
170 ]
171 );
172
173 $this->add_control(
174 'feedback_form_width',
175 [
176 'label' => __( 'Width', 'betterdocs' ),
177 'type' => Controls_Manager::SLIDER,
178 'size_units' => ['px'],
179 'range' => [
180 'px' => [
181 'max' => 1000,
182 'step' => 1
183 ]
184 ],
185 'selectors' => [
186 '{{WRAPPER}} .betterdocs-modalwindow .modal-content' => 'width: {{SIZE}}px;'
187 ]
188 ]
189 );
190
191 $this->add_control(
192 'feedback_form_height',
193 [
194 'label' => __( 'Height', 'betterdocs' ),
195 'type' => Controls_Manager::SLIDER,
196 'size_units' => ['px'],
197 'range' => [
198 'px' => [
199 'max' => 1000,
200 'step' => 1
201 ]
202 ],
203 'selectors' => [
204 '{{WRAPPER}} .betterdocs-modalwindow .modal-content' => 'height: {{SIZE}}px;'
205 ]
206 ]
207 );
208
209 $this->add_control(
210 'feedback_form_heading',
211 [
212 'label' => esc_html__( 'Heading', 'betterdocs' ),
213 'type' => Controls_Manager::HEADING
214 ]
215 );
216
217 $this->add_control(
218 'feedback_form_heading_color',
219 [
220 'label' => esc_html__( 'Color', 'betterdocs' ),
221 'type' => Controls_Manager::COLOR,
222 'selectors' => [
223 '{{WRAPPER}} #betterdocs-form-modal .modal-inner .modal-content .feedback-form-title' => 'color: {{VALUE}};'
224 ]
225 ]
226 );
227
228 $this->add_group_control(
229 Group_Control_Typography::get_type(),
230 [
231 'name' => 'feedback_form_heading_typography',
232 'selector' => '{{WRAPPER}} #betterdocs-form-modal .modal-inner .modal-content .feedback-form-title'
233 ]
234 );
235
236 $this->add_responsive_control(
237 'align',
238 [
239 'label' => __( 'Alignment', 'betterdocs' ),
240 'type' => Controls_Manager::CHOOSE,
241 'options' => [
242 'left' => [
243 'title' => __( 'Left', 'betterdocs' ),
244 'icon' => 'eicon-text-align-left'
245 ],
246 'center' => [
247 'title' => __( 'Center', 'betterdocs' ),
248 'icon' => 'eicon-text-align-center'
249 ],
250 'right' => [
251 'title' => __( 'Right', 'betterdocs' ),
252 'icon' => 'eicon-text-align-right'
253 ],
254 'justify' => [
255 'title' => __( 'Justified', 'betterdocs' ),
256 'icon' => 'eicon-text-align-justify'
257 ]
258 ],
259 'default' => '',
260 'selectors' => [
261 '{{WRAPPER}} #betterdocs-form-modal .modal-inner .modal-content .feedback-form-title' => 'text-align: {{VALUE}};'
262 ]
263 ]
264 );
265
266 $this->add_control(
267 'feedback_form_label',
268 [
269 'label' => esc_html__( 'Lable', 'betterdocs' ),
270 'type' => Controls_Manager::HEADING
271 ]
272 );
273
274 $this->add_control(
275 'feedback_form_label_color',
276 [
277 'label' => esc_html__( 'Color', 'betterdocs' ),
278 'type' => Controls_Manager::COLOR,
279 'selectors' => [
280 '{{WRAPPER}} .betterdocs-modalwindow .betterdocs-feedback-form label' => 'color: {{VALUE}};'
281 ]
282 ]
283 );
284
285 $this->add_group_control(
286 Group_Control_Typography::get_type(),
287 [
288 'name' => 'feedback_form_label_typography',
289 'selector' => '{{WRAPPER}} .betterdocs-modalwindow .betterdocs-feedback-form label'
290 ]
291 );
292
293 $this->add_control(
294 'feedback_form_label_space',
295 [
296 'label' => __( 'Space', 'betterdocs' ),
297 'type' => Controls_Manager::SLIDER,
298 'size_units' => ['px'],
299 'range' => [
300 'px' => [
301 'max' => 500,
302 'step' => 1
303 ]
304 ],
305 'selectors' => [
306 '{{WRAPPER}} .betterdocs-modalwindow .betterdocs-feedback-form label input,{{WRAPPER}} .betterdocs-modalwindow .betterdocs-feedback-form label textarea' => 'margin-top: {{SIZE}}{{UNIT}};'
307 ]
308 ]
309 );
310
311 $this->add_control(
312 'feedback_form_button',
313 [
314 'label' => esc_html__( 'Button', 'betterdocs' ),
315 'type' => Controls_Manager::HEADING
316 ]
317 );
318
319 $this->add_control(
320 'feedback_form_button_background',
321 [
322 'label' => esc_html__( 'Background', 'betterdocs' ),
323 'type' => Controls_Manager::COLOR,
324 'selectors' => [
325 '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' => 'background-color: {{VALUE}};'
326 ]
327 ]
328 );
329
330 $this->add_control(
331 'feedback_form_button_color',
332 [
333 'label' => esc_html__( 'Text Color', 'betterdocs' ),
334 'type' => Controls_Manager::COLOR,
335 'selectors' => [
336 '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' => 'color: {{VALUE}};'
337 ]
338 ]
339 );
340
341 $this->add_group_control(
342 Group_Control_Typography::get_type(),
343 [
344 'name' => 'feedback_form_button_typography',
345 'selector' => '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn'
346 ]
347 );
348
349 $this->add_responsive_control(
350 'feedback_form_button_width',
351 [
352 'label' => esc_html__( 'Width', 'betterdocs' ),
353 'type' => Controls_Manager::SLIDER,
354 'size_units' => ['px', '%'],
355 'range' => [
356 'px' => [
357 'min' => 0,
358 'max' => 500,
359 'step' => 1
360 ],
361 '%' => [
362 'min' => 0,
363 'max' => 100
364 ]
365 ],
366 'selectors' => [
367 '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' => 'width: {{SIZE}}{{UNIT}};'
368 ]
369 ]
370 );
371
372 $this->add_control(
373 'feedback_form_button_padding',
374 [
375 'label' => __( 'Padding', 'betterdocs' ),
376 'type' => Controls_Manager::DIMENSIONS,
377 'size_units' => ['px', 'em', '%'],
378 'selectors' => [
379 '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
380 ]
381 ]
382 );
383
384 $this->add_responsive_control(
385 'feedback_form_button_align',
386 [
387 'label' => __( 'Alignment', 'betterdocs' ),
388 'type' => Controls_Manager::CHOOSE,
389 'options' => [
390 'left' => [
391 'title' => __( 'Left', 'betterdocs' ),
392 'icon' => 'eicon-text-align-left'
393 ],
394 'center' => [
395 'title' => __( 'Center', 'betterdocs' ),
396 'icon' => 'eicon-text-align-center'
397 ],
398 'right' => [
399 'title' => __( 'Right', 'betterdocs' ),
400 'icon' => 'eicon-text-align-right'
401 ],
402 'justify' => [
403 'title' => __( 'Justified', 'betterdocs' ),
404 'icon' => 'eicon-text-align-justify'
405 ]
406 ],
407 'default' => '',
408 'selectors' => [
409 '{{WRAPPER}} .betterdocs-feedback-form .feedback-from-button' => 'text-align: {{VALUE}};'
410 ]
411 ]
412 );
413
414 $this->end_controls_section();
415 }
416
417 protected function render() {
418 $settings = $this->get_settings_for_display();
419
420 betterdocs()->views->get( 'templates/feedback-parts/form', [
421 'widget' => $this,
422 'settings' => $settings
423 ] );
424
425 if( Plugin::instance()->editor->is_edit_mode() ) {
426 $this->render_editor_script();
427 }
428 }
429
430 public function render_editor_script() {
431 betterdocs()->views->get( 'templates/feedback-parts/editor' );
432 }
433 }
434