Test Failed
Push — develop ( 55c79d...550055 )
by Paul
09:38
created

ElementorSiteReview   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 47
dl 0
loc 71
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A shortcodeClass() 0 3 1
A get_icon() 0 3 1
A styleConfig() 0 59 1
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 styleConfig(): array
22
    {
23
        return [
24
            'alignment' => [
25
                'default' => 'start',
26
                'is_responsive' => true,
27
                'label' => esc_html_x('Alignment', 'admin-text', 'site-reviews'),
28
                'options' => [
29
                    'start' => [
30
                        'title' => esc_html_x('Start', 'admin-text', 'site-reviews'),
31
                        'icon' => 'eicon-flex eicon-align-start-h',
32
                    ],
33
                    'center' => [
34
                        'title' => esc_html_x('Center', 'admin-text', 'site-reviews'),
35
                        'icon' => 'eicon-flex eicon-align-center-h',
36
                    ],
37
                    'end' => [
38
                        'title' => esc_html_x('End', 'admin-text', 'site-reviews'),
39
                        'icon' => 'eicon-flex eicon-align-end-h',
40
                    ],
41
                ],
42
                'selectors' => [
43
                    '{{WRAPPER}} .glsr:not([data-theme]) .glsr-review' => 'text-align: {{VALUE}}; justify-content: {{VALUE}};',
44
                    '{{WRAPPER}} .glsr:not([data-theme]) .glsr-review .glsr-review-actions' => 'justify-content: {{VALUE}};',
45
                    '{{WRAPPER}} .glsr:not([data-theme]) .glsr-review .glsr-review-date' => 'flex: inherit;',
46
                ],
47
                'type' => Controls_Manager::CHOOSE,
48
            ],
49
            'rating_color' => [
50
                'global' => [
51
                    'default' => '',
52
                ],
53
                'label' => esc_html_x('Color', 'admin-text', 'site-reviews'),
54
                'selectors' => [
55
                    '{{WRAPPER}} .glsr:not([data-theme]) .glsr-review .glsr-star-empty' => 'background: {{VALUE}} !important;',
56
                    '{{WRAPPER}} .glsr:not([data-theme]) .glsr-review .glsr-star-full' => 'background: {{VALUE}} !important;',
57
                    '{{WRAPPER}} .glsr:not([data-theme]) .glsr-review .glsr-star-half' => 'background: {{VALUE}} !important;',
58
                ],
59
                'type' => Controls_Manager::COLOR,
60
            ],
61
            'rating_size' => [
62
                'default' => [
63
                    'unit' => 'em',
64
                    'size' => 1.25,
65
                ],
66
                'is_responsive' => true,
67
                'label' => esc_html_x('Star Size', 'admin-text', 'site-reviews'),
68
                'range' => [
69
                    'em' => [
70
                        'min' => 0.25,
71
                        'max' => 2.25,
72
                        'step' => 0.125,
73
                    ],
74
                ],
75
                'selectors' => [
76
                    '{{WRAPPER}} .glsr:not([data-theme]) .glsr-review .glsr-star' => '--glsr-review-star: {{SIZE}}{{UNIT}};',
77
                ],
78
                'size_units' => ['em', 'custom'],
79
                'type' => Controls_Manager::SLIDER,
80
            ],
81
        ];
82
    }
83
}
84