1 | <?php |
||
21 | trait SwitchTrait |
||
22 | { |
||
23 | /** |
||
24 | * @var bool specifies whether the checkbox should be checked or unchecked, when not used with a model. If [[items]], |
||
25 | * [[$checked]] will specify the value to select. |
||
26 | */ |
||
27 | public $checked = false; |
||
28 | /** |
||
29 | * @var array the options for the Bootstrap Switch 3 plugin. |
||
30 | * Please refer to the Bootstrap Switch 3 plugin Web page for possible options. |
||
31 | * @see http://www.bootstrap-switch.org/ |
||
32 | */ |
||
33 | public $clientOptions = []; |
||
34 | /** |
||
35 | * @var array the event handlers for the underlying Bootstrap Switch 3 input JS plugin. |
||
36 | * Please refer to the [Bootstrap Switch 3](http://www.bootstrap-switch.org/) plugin |
||
37 | * Web page for possible events. |
||
38 | */ |
||
39 | public $clientEvents = []; |
||
40 | /** |
||
41 | * @var string the DOM element selector |
||
42 | */ |
||
43 | protected $selector; |
||
44 | |||
45 | /** |
||
46 | * Registers Bootstrap Switch plugin and related events |
||
47 | */ |
||
48 | 6 | public function registerClientScript() |
|
64 | } |
||
65 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: