Completed
Push — master ( cb5fa1...8201f5 )
by Vojta
06:45
created

Statuses   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A listOverrideColumnValue() 0 6 2
1
<?php namespace VojtaSvoboda\Reservations\Controllers;
2
3
use Backend\Classes\Controller;
4
use BackendMenu;
5
use Flash;
6
7
class Statuses extends Controller
8
{
9
    public $implement = [
10
        'Backend\Behaviors\ListController',
11
        'Backend\Behaviors\FormController',
12
        'Backend\Behaviors\ReorderController',
13
    ];
14
15
    public $listConfig = 'config_list.yaml';
16
    public $formConfig = 'config_form.yaml';
17
    public $reorderConfig = 'config_reorder.yaml';
18
19
    public $requiredPermissions = [
20
        'vojtasvoboda.reservations.statuses',
21
    ];
22
23
    public function __construct()
24
    {
25
        parent::__construct();
26
27
        BackendMenu::setContext('VojtaSvoboda.Reservations', 'reservations', 'statuses');
28
    }
29
30
    public function listOverrideColumnValue($record, $columnName, $definition = null)
31
    {
32
        if ($columnName == 'color') {
33
            return '<div style="width:18px;height:18px;background-color:' . $record->color . '"></div>';
34
        }
35
    }
36
}
37