1 | <?php |
||
24 | class IconStateLabel extends Widget |
||
25 | { |
||
26 | /** |
||
27 | * @var Model |
||
28 | */ |
||
29 | public $model; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | public $attribute; |
||
35 | |||
36 | /** |
||
37 | * If the array is passed, then the first parameter will be selected for the true state, |
||
38 | * and the second parameter will be selected for the false state. If the string is passed, |
||
39 | * then attribute will be in only one state for both options. |
||
40 | * |
||
41 | * @var string[] |
||
42 | */ |
||
43 | public $icons; |
||
44 | |||
45 | /** |
||
46 | * If the array is passed, then the first parameter will be selected for the true state, |
||
47 | * and the second parameter will be selected for the false state. If the string is passed, |
||
48 | * then attribute will be in only one state for both options. |
||
49 | * |
||
50 | * @var string[] |
||
51 | */ |
||
52 | public $colors = [ |
||
53 | '#008D50', |
||
54 | '#bdbdbd', |
||
55 | ]; |
||
56 | |||
57 | /** |
||
58 | * If the array is passed, then the first parameter will be selected for the true state, |
||
59 | * and the second parameter will be selected for the false state. If the string is passed, |
||
60 | * then attribute will be in only one state for both options. |
||
61 | * |
||
62 | * @var string[] |
||
63 | */ |
||
64 | public $messages; |
||
65 | |||
66 | /** |
||
67 | * Icon font size in `px`. |
||
68 | * |
||
69 | * @var int |
||
70 | */ |
||
71 | public $size = 18; |
||
72 | |||
73 | public function run(): string |
||
77 | |||
78 | public function getState(): bool |
||
82 | |||
83 | public function getIcon(): string |
||
87 | |||
88 | public function getColor(): string |
||
92 | |||
93 | public function getSize(): string |
||
97 | |||
98 | public function getMessage(): string |
||
102 | |||
103 | protected function renderState(): string |
||
112 | |||
113 | private function variate($variants): string |
||
124 | } |
||
125 |