Skip to content

Commit

Permalink
Add missing 'form-check-label' class for Bootstrap 4
Browse files Browse the repository at this point in the history
E.g.
{!! Former::open()->method('GET') !!}
    {!! Former::checkbox('test')->text('Test checkbox') !!}
{!! Former::close() !!}

Render:
<div class="form-check">
<input class="form-check-input" id="test" type="checkbox" name="test"
value="1">
  <label for="test" class="form-check-label">Test checkbox</label>
</div>

References:
- formers#581
- formers#590
  • Loading branch information
tortuetorche committed Dec 30, 2020
1 parent c5bcd07 commit 84aea08
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Former/Traits/Checkable.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ protected function createCheckable($item, $fallbackValue = 1)
$element = (is_object($field)) ? $field->render() : $field;
} elseif ($this->app['former']->framework() == 'TwitterBootstrap4') {
// Revised for Bootstrap 4, move the 'input' outside of the 'label'
$element = $field . Element::create('label', $label)->for($attributes['id'])->class($class)->render();
$labelClass = 'form-check-label';
$element = $field . Element::create('label', $label)->for($attributes['id'])->class($labelClass)->render();

$wrapper_class = $this->inline ? 'form-check form-check-inline' : 'form-check';

Expand Down

0 comments on commit 84aea08

Please sign in to comment.