Test Failed
Push — develop ( e98958...f9165c )
by Paul
08:57
created

ElementorSiteReviewsSummary   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 136
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 96
c 0
b 0
f 0
dl 0
loc 136
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A shortcodeClass() 0 3 1
A get_icon() 0 3 1
B styleConfig() 0 124 1
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\Elementor;
4
5
use Elementor\Controls_Manager;
6
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewsSummaryShortcode;
7
8
class ElementorSiteReviewsSummary extends ElementorWidget
9
{
10
    public function get_icon(): string
11
    {
12
        return 'eicon-glsr-summary';
13
    }
14
15
    public static function shortcodeClass(): string
16
    {
17
        return SiteReviewsSummaryShortcode::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
                'label_block' => false,
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-summary' => 'justify-content: {{VALUE}};',
44
                    '{{WRAPPER}} .glsr-summary-text' => 'text-align: {{VALUE}};',
45
                ],
46
                'type' => Controls_Manager::CHOOSE,
47
            ],
48
            'max_width' => [
49
                'default' => [
50
                    'unit' => 'px',
51
                    'size' => 450,
52
                ],
53
                'is_responsive' => true,
54
                'label' => esc_html_x('Max Width', 'admin-text', 'site-reviews'),
55
                'range' => [
56
                    '%' => [
57
                        'min' => 50,
58
                        'max' => 100,
59
                    ],
60
                    'px' => [
61
                        'min' => 50,
62
                        'max' => 1000,
63
                    ],
64
                ],
65
                'selectors' => [
66
                    '{{WRAPPER}}' => '--glsr-max-w: {{SIZE}}{{UNIT}};',
67
                ],
68
                'size_units' => ['px', '%', 'custom'],
69
                'type' => Controls_Manager::SLIDER,
70
            ],
71
            'percentage_bar_height' => [
72
                'default' => [
73
                    'unit' => 'em',
74
                    'size' => 1,
75
                ],
76
                'is_responsive' => true,
77
                'label' => esc_html_x('Percent Bar Height', 'admin-text', 'site-reviews'),
78
                'range' => [
79
                    'em' => [
80
                        'max' => 1.5,
81
                        'min' => 0.1,
82
                        'step' => 0.1,
83
                    ],
84
                ],
85
                'selectors' => [
86
                    '{{WRAPPER}}' => '--glsr-bar-size: {{SIZE}}{{UNIT}};',
87
                ],
88
                'size_units' => ['em', 'custom'],
89
                'type' => Controls_Manager::SLIDER,
90
            ],
91
            'percentage_bar_spacing' => [
92
                'default' => [
93
                    'size' => 1.5,
94
                    'unit' => 'em',
95
                ],
96
                'is_responsive' => true,
97
                'label' => esc_html_x('Percent Bar Spacing', 'admin-text', 'site-reviews'),
98
                'range' => [
99
                    'em' => [
100
                        'max' => 2,
101
                        'min' => 1,
102
                        'step' => 0.1,
103
                    ],
104
                ],
105
                'selectors' => [
106
                    '{{WRAPPER}}' => '--glsr-bar-spacing: {{SIZE}}{{UNIT}};',
107
                ],
108
                'size_units' => ['em', 'custom'],
109
                'type' => Controls_Manager::SLIDER,
110
            ],
111
            'rating_color' => [
112
                'global' => [
113
                    'default' => '',
114
                ],
115
                'label' => esc_html_x('Color', 'admin-text', 'site-reviews'),
116
                'label_block' => false,
117
                'selectors' => [
118
                    '{{WRAPPER}} .glsr:not([data-theme]) .glsr-bar-background-percent' => '--glsr-bar-bg: {{VALUE}} !important',
119
                    '{{WRAPPER}} .glsr:not([data-theme]) .glsr-star-empty' => 'background: {{VALUE}} !important;',
120
                    '{{WRAPPER}} .glsr:not([data-theme]) .glsr-star-full' => 'background: {{VALUE}} !important;',
121
                    '{{WRAPPER}} .glsr:not([data-theme]) .glsr-star-half' => 'background: {{VALUE}} !important;',
122
                ],
123
                'type' => Controls_Manager::COLOR,
124
            ],
125
            'rating_size' => [
126
                'default' => [
127
                    'unit' => 'em',
128
                    'size' => 1.5,
129
                ],
130
                'is_responsive' => true,
131
                'label' => esc_html_x('Star Size', 'admin-text', 'site-reviews'),
132
                'range' => [
133
                    'em' => [
134
                        'min' => 0.25,
135
                        'max' => 2.25,
136
                        'step' => 0.125,
137
                    ],
138
                ],
139
                'selectors' => [
140
                    '{{WRAPPER}}' => '--glsr-summary-star: {{SIZE}}{{UNIT}};',
141
                ],
142
                'size_units' => ['em', 'custom'],
143
                'type' => Controls_Manager::SLIDER,
144
            ],
145
        ];
146
    }
147
}
148