From 6789d54cb3261b8be649a4154599ad084e3f66c3 Mon Sep 17 00:00:00 2001 From: Simon Karlen Date: Tue, 12 Oct 2021 12:34:14 +0200 Subject: [PATCH] fixed #15 --- CHANGELOG.md | 1 + src/ActiveField.php | 12 ++++++------ tests/ActiveFieldTest.php | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ef49ca..2d56ca4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Yii Framework 2 bootstrap5 extension Change Log 2.0.2 under development ----------------------- +- Bug #15: Fixed inline rendering of checkboxLists and radioLists (simialbi) - Bug #5: BootstrapWidgetTrait::registerPlugin do nothing if no clientOptions is provided (dicrtarasov) - Enh #11: Brought back close button api (simialbi) - Bug #6: yii\bootstrap5\BaseHtml::staticControl(): Argument #1 ($value) must be of type string, int given (dicrtarasov) diff --git a/src/ActiveField.php b/src/ActiveField.php index 353df0d..78dd8e3 100644 --- a/src/ActiveField.php +++ b/src/ActiveField.php @@ -341,9 +341,9 @@ class ActiveField extends \yii\widgets\ActiveField 'value' => $value, ], $itemOptions); $wrapperOptions = ArrayHelper::remove($options, 'wrapperOptions', ['class' => ['form-check']]); -// if ($this->inline) { -// Html::addCssClass($wrapperOptions, 'custom-control-inline'); -// } + if ($this->inline) { + Html::addCssClass($wrapperOptions, 'form-check-inline'); + } $html = Html::beginTag('div', $wrapperOptions) . "\n" . Html::checkbox($name, $checked, $options) . "\n"; @@ -383,9 +383,9 @@ class ActiveField extends \yii\widgets\ActiveField 'value' => $value, ], $itemOptions); $wrapperOptions = ArrayHelper::remove($options, 'wrapperOptions', ['class' => ['form-check']]); -// if ($this->inline) { -// Html::addCssClass($wrapperOptions, 'custom-control-inline'); -// } + if ($this->inline) { + Html::addCssClass($wrapperOptions, 'form-check-inline'); + } $html = Html::beginTag('div', $wrapperOptions) . "\n" . Html::radio($name, $checked, $options) . "\n"; diff --git a/tests/ActiveFieldTest.php b/tests/ActiveFieldTest.php index 4b2d642..71ed873 100644 --- a/tests/ActiveFieldTest.php +++ b/tests/ActiveFieldTest.php @@ -194,12 +194,12 @@ HTML; $expectedHtml = << -
+
-
+
@@ -220,12 +220,12 @@ HTML; $expectedHtml = << -
+
-
+