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

BricksSiteReview::designConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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