Fix class attribute in listBox() and dropDownList() of ActiveField

This commit is contained in:
Anton 2021-11-30 22:48:06 +03:00 committed by GitHub
parent 9be83b526a
commit 967118226c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,7 +117,7 @@ class ActiveField extends \yii\widgets\ActiveField
* *
* If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly. * If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
* *
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. * @see Html::renderTagAttributes() for details on how attributes are being rendered.
* @since 2.0.7 * @since 2.0.7
*/ */
public $checkOptions = [ public $checkOptions = [
@ -132,7 +132,7 @@ class ActiveField extends \yii\widgets\ActiveField
* *
* If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly. * If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
* *
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. * @see Html::renderTagAttributes() for details on how attributes are being rendered.
* @since 2.0.7 * @since 2.0.7
*/ */
public $radioOptions = [ public $radioOptions = [
@ -431,6 +431,8 @@ class ActiveField extends \yii\widgets\ActiveField
if ($this->form->layout === ActiveForm::LAYOUT_INLINE) { if ($this->form->layout === ActiveForm::LAYOUT_INLINE) {
Html::removeCssClass($this->labelOptions, 'visually-hidden'); Html::removeCssClass($this->labelOptions, 'visually-hidden');
} }
Html::removeCssClass($options, 'form-control');
Html::addCssClass($options, ['widget' => 'form-select']);
return parent::listBox($items, $options); return parent::listBox($items, $options);
} }
@ -443,6 +445,8 @@ class ActiveField extends \yii\widgets\ActiveField
if ($this->form->layout === ActiveForm::LAYOUT_INLINE) { if ($this->form->layout === ActiveForm::LAYOUT_INLINE) {
Html::removeCssClass($this->labelOptions, 'visually-hidden'); Html::removeCssClass($this->labelOptions, 'visually-hidden');
} }
Html::removeCssClass($options, 'form-control');
Html::addCssClass($options, ['widget' => 'form-select']);
return parent::dropdownList($items, $options); return parent::dropdownList($items, $options);
} }