1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Sco\Admin\Form\Elements; |
4
|
|
|
|
5
|
|
|
class ElSwitch extends NamedElement |
6
|
|
|
{ |
7
|
|
|
protected $type = 'elswitch'; |
8
|
|
|
|
9
|
|
|
protected $text = ['ON', 'OFF']; |
10
|
|
|
protected $values = ['yes', 'no']; |
11
|
|
|
protected $color = []; |
12
|
|
|
protected $iconClass = []; |
13
|
|
|
|
14
|
|
|
protected $width = 58; |
15
|
|
|
|
16
|
|
|
public function getWidth() |
17
|
|
|
{ |
18
|
|
|
return $this->width; |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function setWidth($value) |
22
|
|
|
{ |
23
|
|
|
$this->width = intval($value); |
24
|
|
|
|
25
|
|
|
return $this; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function getValues() |
29
|
|
|
{ |
30
|
|
|
return $this->values; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function setValues($on, $off) |
34
|
|
|
{ |
35
|
|
|
$this->values = [$on, $off]; |
36
|
|
|
|
37
|
|
|
return $this; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function getText() |
41
|
|
|
{ |
42
|
|
|
return $this->text; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function setText($on, $off) |
46
|
|
|
{ |
47
|
|
|
$this->text = [$on, $off]; |
48
|
|
|
|
49
|
|
|
return $this; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function getColor() |
53
|
|
|
{ |
54
|
|
|
return $this->color; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function setColor($on, $off) |
58
|
|
|
{ |
59
|
|
|
$this->color = [$on, $off]; |
60
|
|
|
|
61
|
|
|
return $this; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function getIconClass() |
65
|
|
|
{ |
66
|
|
|
return $this->iconClass; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function setIconClass($on, $off) |
70
|
|
|
{ |
71
|
|
|
$this->iconClass = [$on, $off]; |
72
|
|
|
|
73
|
|
|
return $this; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function toArray() |
77
|
|
|
{ |
78
|
|
|
return parent::toArray() + [ |
79
|
|
|
'text' => $this->getText(), |
80
|
|
|
'values' => $this->getValues(), |
81
|
|
|
'color' => $this->getColor(), |
82
|
|
|
'iconClass' => $this->getIconClass(), |
83
|
|
|
'width' => $this->getWidth(), |
84
|
|
|
]; |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|