Passed
Push — develop ( 39ad60...0ca1de )
by Paul
14:09
created

BricksSiteReviews::render()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\Bricks\Elements;
4
5
use GeminiLabs\SiteReviews\Integrations\Bricks\BricksElement;
6
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewsShortcode;
7
8
class BricksSiteReviews extends BricksElement
9
{
10
    public function designConfig(): array
11
    {
12
        return [
13
            'style_align' => [
14
                'exclude' => ['stretch', 'auto'],
15
                'group' => 'design',
16
                'inline' => true,
17
                'label' => esc_html__('Align', 'bricks'),
18
                'rerender' => true,
19
                'tab' => 'style',
20
                'themeStyle' => true,
21
                'type' => 'align-items',
22
            ],
23
            'separator_review' => [
24
                'group' => 'design',
25
                'label' => esc_html_x('Review', 'admin-text', 'site-reviews'),
26
                'tab' => 'content',
27
                'type' => 'separator',
28
            ],
29
            'style_text_align' => [
30
                'exclude' => ['auto', 'justify'],
31
                'group' => 'design',
32
                'inline' => true,
33
                'label' => esc_html_x('Text Align', 'admin-text', 'site-reviews'),
34
                'rerender' => true,
35
                'tab' => 'style',
36
                'themeStyle' => true,
37
                'type' => 'text-align',
38
            ],
39
            'style_heading' => [
40
                'css' => [[
41
                    'selector' => '.glsr:not([data-theme]) h2, .glsr:not([data-theme]) h3, .glsr:not([data-theme]) h4',
42
                    'property' => 'font',
43
                ]],
44
                'group' => 'design',
45
                'label' => esc_html_x('Heading', 'admin-text', 'site-reviews'),
46
                'tab' => 'style',
47
                'themeStyle' => true,
48
                'type' => 'typography',
49
            ],
50
        ];
51
    }
52
53
    public function render()
54
    {
55
        if (!$this->shortcodeInstance()->hasVisibleFields($this->settings)) {
56
            $this->render_element_placeholder([
57
                'title' => esc_html_x('You have hidden all of the fields.', 'admin-text', 'site-reviews'),
58
            ]);
59
            return;
60
        }
61
        parent::render();
62
    }
63
64
    public static function shortcodeClass(): string
65
    {
66
        return SiteReviewsShortcode::class;
67
    }
68
}
69