Browse Source

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

tags/2.0.7
Marco 9 years ago committed by Alexander Makarov
parent
commit
4dd9f52e2a
  1. 2
      CHANGELOG.md
  2. 12
      ToggleButtonGroup.php

2
CHANGELOG.md

@ -4,7 +4,7 @@ Yii Framework 2 bootstrap extension Change Log
2.0.7 under development
-----------------------
- Bug #126: `yii\bootstrap\ToggleButtonGroup` was unable to work without model (makroxyz)
2.0.6 March 17, 2016
--------------------

12
ToggleButtonGroup.php

@ -72,9 +72,17 @@ class ToggleButtonGroup extends InputWidget
}
switch ($this->type) {
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':
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:
throw new InvalidConfigException("Unsupported type '{$this->type}'");
}

Loading…
Cancel
Save