Commit 6288a386 authored by Klimov Paul's avatar Klimov Paul

Merge

parents 37f89ef5 2c83bde8
...@@ -255,8 +255,10 @@ class ActiveField extends \yii\widgets\ActiveField ...@@ -255,8 +255,10 @@ class ActiveField extends \yii\widgets\ActiveField
]; ];
} }
} elseif (!isset($options['item'])) { } elseif (!isset($options['item'])) {
$options['item'] = function ($index, $label, $name, $checked, $value) { $itemOptions = isset($options['itemOptions']) ? $options['itemOptions'] : [];
return '<div class="checkbox">' . Html::checkbox($name, $checked, ['label' => $label, 'value' => $value]) . '</div>'; $options['item'] = function ($index, $label, $name, $checked, $value) use ($itemOptions) {
$options = array_merge(['label' => $label, 'value' => $value], $itemOptions);
return '<div class="checkbox">' . Html::checkbox($name, $checked, $options) . '</div>';
}; };
} }
parent::checkboxList($items, $options); parent::checkboxList($items, $options);
...@@ -281,8 +283,10 @@ class ActiveField extends \yii\widgets\ActiveField ...@@ -281,8 +283,10 @@ class ActiveField extends \yii\widgets\ActiveField
]; ];
} }
} elseif (!isset($options['item'])) { } elseif (!isset($options['item'])) {
$options['item'] = function ($index, $label, $name, $checked, $value) { $itemOptions = isset($options['itemOptions']) ? $options['itemOptions'] : [];
return '<div class="radio">' . Html::radio($name, $checked, ['label' => $label, 'value' => $value]) . '</div>'; $options['item'] = function ($index, $label, $name, $checked, $value) use ($itemOptions) {
$options = array_merge(['label' => $label, 'value' => $value], $itemOptions);
return '<div class="radio">' . Html::radio($name, $checked, $options) . '</div>';
}; };
} }
parent::radioList($items, $options); parent::radioList($items, $options);
......
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