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