Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
RichText
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
5 / 5
5
100.00% covered (success)
100.00%
1 / 1
 key
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 label
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 icon
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 description
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 fields
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Widgets\Types;
4
5use App\Widgets\AbstractWidget;
6
7class RichText extends AbstractWidget
8{
9    protected string $view = 'widgets.rich-text';
10
11    public function key(): string
12    {
13        return 'rich_text';
14    }
15
16    public function label(): string
17    {
18        return 'Text block';
19    }
20
21    public function icon(): string
22    {
23        return 'fas fa-align-left';
24    }
25
26    public function description(): string
27    {
28        return 'A heading and a paragraph of text.';
29    }
30
31    public function fields(): array
32    {
33        return [
34            'title' => ['type' => 'text', 'label' => 'Heading', 'default' => ''],
35            'body' => ['type' => 'textarea', 'label' => 'Text', 'default' => ''],
36            'align' => ['type' => 'select', 'label' => 'Alignment', 'default' => 'left',
37                'options' => ['left' => 'Left', 'center' => 'Centre', 'right' => 'Right']],
38        ];
39    }
40}