Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
28.57% |
4 / 14 |
|
80.00% |
4 / 5 |
CRAP | |
0.00% |
0 / 1 |
| LinkList | |
28.57% |
4 / 14 |
|
80.00% |
4 / 5 |
14.11 | |
0.00% |
0 / 1 |
| key | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| label | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| icon | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| description | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| fields | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Widgets\Types; |
| 4 | |
| 5 | use App\Widgets\AbstractWidget; |
| 6 | |
| 7 | class LinkList extends AbstractWidget |
| 8 | { |
| 9 | protected string $view = 'widgets.link-list'; |
| 10 | |
| 11 | public function key(): string |
| 12 | { |
| 13 | return 'link_list'; |
| 14 | } |
| 15 | |
| 16 | public function label(): string |
| 17 | { |
| 18 | return 'Link list'; |
| 19 | } |
| 20 | |
| 21 | public function icon(): string |
| 22 | { |
| 23 | return 'fas fa-list-ul'; |
| 24 | } |
| 25 | |
| 26 | public function description(): string |
| 27 | { |
| 28 | return 'A titled column of links — or point it at a menu.'; |
| 29 | } |
| 30 | |
| 31 | public function fields(): array |
| 32 | { |
| 33 | return [ |
| 34 | 'title' => ['type' => 'text', 'label' => 'Heading', 'default' => 'Quick links'], |
| 35 | 'menu_handle' => ['type' => 'text', 'label' => 'Menu handle (optional)', 'default' => '', |
| 36 | 'help' => 'Use a menu built in Settings → Menus. Leave blank to use the list below.'], |
| 37 | 'links' => ['type' => 'repeater', 'label' => 'Links', 'default' => [], |
| 38 | 'subfields' => [ |
| 39 | ['key' => 'label', 'type' => 'text', 'label' => 'Text'], |
| 40 | ['key' => 'url', 'type' => 'text', 'label' => 'URL'], |
| 41 | ]], |
| 42 | ]; |
| 43 | } |
| 44 | } |