1 | <?php |
||
59 | class SwitchRadio extends InputWidget |
||
60 | { |
||
61 | use SwitchTrait; |
||
62 | |||
63 | /** |
||
64 | * @var bool whether to display the options inline. Defaults to true. |
||
65 | */ |
||
66 | public $inline = true; |
||
67 | /** |
||
68 | * @var array the radio button options to render. The syntax is: |
||
69 | * ``` |
||
70 | * 'items' => [ |
||
71 | * [ |
||
72 | * 'label' => 'Label of item', |
||
73 | * 'value' => 20, |
||
74 | * 'options' => [], |
||
75 | * 'labelOptions' => [] |
||
76 | * ] |
||
77 | * ] |
||
78 | * ``` |
||
79 | * - label: string the label of item. If empty, will not be displayed. |
||
80 | * - value: string the value of the item. |
||
81 | * - options: HTML attributes of the item. |
||
82 | * - labelOptions: HTML attributes of the label. |
||
83 | * |
||
84 | * You can also specify items like this: |
||
85 | * ``` |
||
86 | * 'items' => [ |
||
87 | * 10 => 'Label of Item', |
||
88 | * [ |
||
89 | * // ... |
||
90 | * ] |
||
91 | * ] |
||
92 | * ``` |
||
93 | * On this case, the key of the array will be used as a value and the value of the array as a label. |
||
94 | */ |
||
95 | public $items = []; |
||
96 | /** |
||
97 | * @var array HTML attributes common to each items' label |
||
98 | */ |
||
99 | public $labelOptions = []; |
||
100 | /** |
||
101 | * @var string the separator content between each radio item |
||
102 | */ |
||
103 | public $separator = " "; |
||
104 | /** |
||
105 | * @var array HTML attributes for the radio group container |
||
106 | */ |
||
107 | public $containerOptions = []; |
||
108 | |||
109 | /** |
||
110 | * @inheritdoc |
||
111 | * @throws \yii\base\InvalidConfigException |
||
112 | */ |
||
113 | 6 | public function init() |
|
124 | |||
125 | /** |
||
126 | * @inheritdoc |
||
127 | */ |
||
128 | 3 | public function run() |
|
154 | } |
||
155 |