zucchi/ZucchiBootstrap

Not adding bootstrap classes to labels

Closed this issue · 1 comments

Missing addition of (class="checkbox" / class="radio" ) in label tags of multiple-checkboxes and radio elements, hence bootstrap CSS not applying on these elements

<label class="checkbox">
  <input type="checkbox" value="">
  Option one is this and that—be sure to include why it's great
</label>

<label class="radio">
  <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>
  Option one is this and that—be sure to include why it's great
</label>
<label class="radio">
  <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
  Option two can be something else and selecting it will deselect option one
</label>

Hi Dkaswan,

We don't add the classes to labels on purpose in case you wish to use something different.

You can however add the classes yourself by adding the label_attributes option:

$form->add(array(
        'name' => 'My Options',
        'type' => 'Zend\Form\Element\MultiCheckbox',
        'attributes' => array(
            'type' => 'multi_checkbox',
        ),
        'options' => array(
            'label_attributes' => array('class' => 'checkbox'),
        ),
    ));