Commit 4dd9f52e authored by Marco's avatar Marco Committed by Alexander Makarov

Fixes #126: `yii\bootstrap\ToggleButtonGroup` was unable to work without model

parent e64170ff
...@@ -4,7 +4,7 @@ Yii Framework 2 bootstrap extension Change Log ...@@ -4,7 +4,7 @@ Yii Framework 2 bootstrap extension Change Log
2.0.7 under development 2.0.7 under development
----------------------- -----------------------
- Bug #126: `yii\bootstrap\ToggleButtonGroup` was unable to work without model (makroxyz)
2.0.6 March 17, 2016 2.0.6 March 17, 2016
-------------------- --------------------
......
...@@ -72,9 +72,17 @@ class ToggleButtonGroup extends InputWidget ...@@ -72,9 +72,17 @@ class ToggleButtonGroup extends InputWidget
} }
switch ($this->type) { switch ($this->type) {
case 'checkbox': case 'checkbox':
return Html::activeCheckboxList($this->model, $this->attribute, $this->items, $this->options); if ($this->hasModel()) {
return Html::activeCheckboxList($this->model, $this->attribute, $this->items, $this->options);
} else {
return Html::checkboxList($this->name, $this->value, $this->items, $this->options);
}
case 'radio': case 'radio':
return Html::activeRadioList($this->model, $this->attribute, $this->items, $this->options); if ($this->hasModel()) {
return Html::activeRadioList($this->model, $this->attribute, $this->items, $this->options);
} else {
return Html::radioList($this->name, $this->value, $this->items, $this->options);
}
default: default:
throw new InvalidConfigException("Unsupported type '{$this->type}'"); throw new InvalidConfigException("Unsupported type '{$this->type}'");
} }
...@@ -104,4 +112,4 @@ class ToggleButtonGroup extends InputWidget ...@@ -104,4 +112,4 @@ class ToggleButtonGroup extends InputWidget
} }
return Html::$type($name, $checked, ['label' => $label, 'labelOptions' => $labelOptions, 'value' => $value]); return Html::$type($name, $checked, ['label' => $label, 'labelOptions' => $labelOptions, 'value' => $value]);
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment