1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace GeminiLabs\SiteReviews\Integrations\Elementor; |
4
|
|
|
|
5
|
|
|
use Elementor\Controls_Manager; |
6
|
|
|
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewsShortcode; |
7
|
|
|
|
8
|
|
|
class ElementorSiteReviews extends ElementorWidget |
9
|
|
|
{ |
10
|
|
|
public function get_icon(): string |
11
|
|
|
{ |
12
|
|
|
return 'eicon-glsr-reviews'; |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
public static function shortcodeClass(): string |
16
|
|
|
{ |
17
|
|
|
return SiteReviewsShortcode::class; |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
protected function styleConfig(): array |
21
|
|
|
{ |
22
|
|
|
return [ |
23
|
|
|
'alignment' => [ |
24
|
|
|
'default' => 'start', |
25
|
|
|
'is_responsive' => true, |
26
|
|
|
'label' => esc_html_x('Alignment', 'admin-text', 'site-reviews'), |
27
|
|
|
'options' => [ |
28
|
|
|
'start' => [ |
29
|
|
|
'title' => esc_html_x('Start', 'admin-text', 'site-reviews'), |
30
|
|
|
'icon' => 'eicon-flex eicon-align-start-h', |
31
|
|
|
], |
32
|
|
|
'center' => [ |
33
|
|
|
'title' => esc_html_x('Center', 'admin-text', 'site-reviews'), |
34
|
|
|
'icon' => 'eicon-flex eicon-align-center-h', |
35
|
|
|
], |
36
|
|
|
'end' => [ |
37
|
|
|
'title' => esc_html_x('End', 'admin-text', 'site-reviews'), |
38
|
|
|
'icon' => 'eicon-flex eicon-align-end-h', |
39
|
|
|
], |
40
|
|
|
], |
41
|
|
|
'selectors' => [ |
42
|
|
|
'{{WRAPPER}} .glsr:not([data-theme]) .glsr-review' => 'text-align: {{VALUE}}; justify-content: {{VALUE}};', |
43
|
|
|
'{{WRAPPER}} .glsr:not([data-theme]) .glsr-review .glsr-review-actions' => 'justify-content: {{VALUE}};', |
44
|
|
|
'{{WRAPPER}} .glsr:not([data-theme]) .glsr-review .glsr-review-date' => 'flex: inherit;', |
45
|
|
|
], |
46
|
|
|
'type' => Controls_Manager::CHOOSE, |
47
|
|
|
], |
48
|
|
|
'spacing' => [ |
49
|
|
|
'default' => [ |
50
|
|
|
'unit' => 'em', |
51
|
|
|
'size' => 2, |
52
|
|
|
], |
53
|
|
|
'is_responsive' => true, |
54
|
|
|
'label' => esc_html_x('Review Spacing', 'admin-text', 'site-reviews'), |
55
|
|
|
'range' => [ |
56
|
|
|
'em' => [ |
57
|
|
|
'min' => 0, |
58
|
|
|
'max' => 4, |
59
|
|
|
'step' => 0.125, |
60
|
|
|
], |
61
|
|
|
], |
62
|
|
|
'selectors' => [ |
63
|
|
|
'{{WRAPPER}} .glsr-reviews' => '--glsr-gap-xl: {{SIZE}}{{UNIT}};', |
64
|
|
|
], |
65
|
|
|
'size_units' => ['em', 'custom'], |
66
|
|
|
'type' => Controls_Manager::SLIDER, |
67
|
|
|
], |
68
|
|
|
'rating_color' => [ |
69
|
|
|
'global' => [ |
70
|
|
|
'default' => '', |
71
|
|
|
], |
72
|
|
|
'label' => esc_html_x('Color', 'admin-text', 'site-reviews'), |
73
|
|
|
'selectors' => [ |
74
|
|
|
'{{WRAPPER}} .glsr:not([data-theme]) .glsr-review .glsr-star-empty' => 'background: {{VALUE}} !important;', |
75
|
|
|
'{{WRAPPER}} .glsr:not([data-theme]) .glsr-review .glsr-star-full' => 'background: {{VALUE}} !important;', |
76
|
|
|
'{{WRAPPER}} .glsr:not([data-theme]) .glsr-review .glsr-star-half' => 'background: {{VALUE}} !important;', |
77
|
|
|
], |
78
|
|
|
'type' => Controls_Manager::COLOR, |
79
|
|
|
], |
80
|
|
|
'rating_size' => [ |
81
|
|
|
'default' => [ |
82
|
|
|
'unit' => 'em', |
83
|
|
|
'size' => 1.25, |
84
|
|
|
], |
85
|
|
|
'is_responsive' => true, |
86
|
|
|
'label' => esc_html_x('Star Size', 'admin-text', 'site-reviews'), |
87
|
|
|
'range' => [ |
88
|
|
|
'em' => [ |
89
|
|
|
'min' => 0.25, |
90
|
|
|
'max' => 2.25, |
91
|
|
|
'step' => 0.125, |
92
|
|
|
], |
93
|
|
|
], |
94
|
|
|
'selectors' => [ |
95
|
|
|
'{{WRAPPER}} .glsr:not([data-theme]) .glsr-review .glsr-star' => '--glsr-review-star: {{SIZE}}{{UNIT}};', |
96
|
|
|
], |
97
|
|
|
'size_units' => ['em', 'custom'], |
98
|
|
|
'type' => Controls_Manager::SLIDER, |
99
|
|
|
], |
100
|
|
|
]; |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
|