Skip to content

Commit

Permalink
Fix #243: Checkbox labels in inline forms are no longer hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
BBoom authored Apr 17, 2024
1 parent f9a55eb commit e8a24f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Yii Framework 2 bootstrap4 extension Change Log
------------------------

- Enh #237: Added `Accordion::headerToggleOptions` (nagyt234)
- Bug #243: Checkbox labels in inline forms are no longer hidden (BBoom)

2.0.11 May 22, 2023
-------------------
Expand Down
3 changes: 3 additions & 0 deletions src/ActiveField.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ public function checkbox($options = [], $enclosedByLabel = false)
Html::removeCssClass($this->labelOptions, $this->horizontalCssClasses['label']);
Html::addCssClass($this->wrapperOptions, $this->horizontalCssClasses['offset']);
}
if ($this->form->layout === ActiveForm::LAYOUT_INLINE) {
Html::removeCssClass($this->labelOptions, 'sr-only');
}
unset($options['template']);

if ($enclosedByLabel) {
Expand Down
2 changes: 1 addition & 1 deletion tests/ActiveFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function testInlineLayout()
<div class="form-group field-dynamicmodel-checkboxname">
<div class="custom-control custom-checkbox">
<input type="hidden" name="DynamicModel[checkboxName]" value="0"><input type="checkbox" id="dynamicmodel-checkboxname" class="custom-control-input" name="DynamicModel[checkboxName]" value="1">
<label class="sr-only custom-control-label" for="dynamicmodel-checkboxname">Checkbox Name</label>
<label class="custom-control-label" for="dynamicmodel-checkboxname">Checkbox Name</label>
</div>
Expand Down

0 comments on commit e8a24f2

Please sign in to comment.