1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace GeminiLabs\SiteReviews\Integrations\Elementor; |
4
|
|
|
|
5
|
|
|
use Elementor\Controls_Manager; |
6
|
|
|
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewsFormShortcode; |
7
|
|
|
|
8
|
|
|
class ElementorSiteReviewsForm extends ElementorWidget |
9
|
|
|
{ |
10
|
|
|
public function get_icon(): string |
11
|
|
|
{ |
12
|
|
|
return 'eicon-glsr-form'; |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
public static function shortcodeClass(): string |
16
|
|
|
{ |
17
|
|
|
return SiteReviewsFormShortcode::class; |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
protected function styleConfig(): array |
21
|
|
|
{ |
22
|
|
|
return [ |
23
|
|
|
'spacing' => [ |
24
|
|
|
'default' => [ |
25
|
|
|
'unit' => 'em', |
26
|
|
|
'size' => 0.75, |
27
|
|
|
], |
28
|
|
|
'is_responsive' => true, |
29
|
|
|
'label' => esc_html_x('Field Spacing', 'admin-text', 'site-reviews'), |
30
|
|
|
'range' => [ |
31
|
|
|
'em' => [ |
32
|
|
|
'min' => 0, |
33
|
|
|
'max' => 2, |
34
|
|
|
'step' => 0.125, |
35
|
|
|
], |
36
|
|
|
], |
37
|
|
|
'selectors' => [ |
38
|
|
|
'{{WRAPPER}} .glsr-review-form' => '--glsr-gap-md: {{SIZE}}{{UNIT}};', |
39
|
|
|
'{{WRAPPER}} .elementor-form .elementor-form-fields-wrapper .glsr-field' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
40
|
|
|
], |
41
|
|
|
'size_units' => ['em', 'custom'], |
42
|
|
|
'type' => Controls_Manager::SLIDER, |
43
|
|
|
], |
44
|
|
|
'rating_color' => [ |
45
|
|
|
'global' => [ |
46
|
|
|
'default' => '', |
47
|
|
|
], |
48
|
|
|
'label' => esc_html_x('Color', 'admin-text', 'site-reviews'), |
49
|
|
|
'selectors' => [ |
50
|
|
|
'{{WRAPPER}} .glsr:not([data-theme]) .glsr-field:not(.glsr-field-is-invalid) .glsr-star-rating--stars > span' => 'background: {{VALUE}} !important;', |
51
|
|
|
'{{WRAPPER}} .glsr:not([data-theme]) .glsr-field-is-invalid .glsr-star-rating--stars > span.gl-active' => 'background: {{VALUE}} !important;', |
52
|
|
|
], |
53
|
|
|
'type' => Controls_Manager::COLOR, |
54
|
|
|
], |
55
|
|
|
'rating_size' => [ |
56
|
|
|
'default' => [ |
57
|
|
|
'unit' => 'em', |
58
|
|
|
'size' => 2, |
59
|
|
|
], |
60
|
|
|
'is_responsive' => true, |
61
|
|
|
'label' => esc_html_x('Star Size', 'admin-text', 'site-reviews'), |
62
|
|
|
'range' => [ |
63
|
|
|
'em' => [ |
64
|
|
|
'min' => 1, |
65
|
|
|
'max' => 3, |
66
|
|
|
'step' => 0.125, |
67
|
|
|
], |
68
|
|
|
], |
69
|
|
|
'selectors' => [ |
70
|
|
|
'{{WRAPPER}} form.glsr-form .glsr-field-rating' => '--glsr-form-star: {{SIZE}}{{UNIT}};', |
71
|
|
|
'{{WRAPPER}} .glsr[data-theme] .glsr-field-rating [data-stars]' => 'font-size: initial;', |
72
|
|
|
'{{WRAPPER}} .glsr[data-theme] .glsr-field-rating [data-stars] > span' => 'font-size: initial; height: var(--glsr-form-star); width: var(--glsr-form-star);', |
73
|
|
|
], |
74
|
|
|
'size_units' => ['em', 'custom'], |
75
|
|
|
'type' => Controls_Manager::SLIDER, |
76
|
|
|
], |
77
|
|
|
'rating_spacing' => [ |
78
|
|
|
'default' => [ |
79
|
|
|
'unit' => 'px', |
80
|
|
|
'size' => 2, |
81
|
|
|
], |
82
|
|
|
'is_responsive' => true, |
83
|
|
|
'label' => esc_html_x('Star Spacing', 'admin-text', 'site-reviews'), |
84
|
|
|
'range' => [ |
85
|
|
|
'px' => [ |
86
|
|
|
'min' => 0, |
87
|
|
|
'max' => 10, |
88
|
|
|
], |
89
|
|
|
], |
90
|
|
|
'selectors' => [ |
91
|
|
|
'{{WRAPPER}} form.glsr-form .glsr-field-rating span[data-rating]' => 'column-gap: {{SIZE}}{{UNIT}};', |
92
|
|
|
], |
93
|
|
|
'size_units' => ['px', 'custom'], |
94
|
|
|
'type' => Controls_Manager::SLIDER, |
95
|
|
|
], |
96
|
|
|
]; |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|