jeudi 24 septembre 2015

How can I display my checkbox choices horizontaly with bootstrap theme for Symfony?

I have a very simple form with two checkboxes and one submit button that I want to display using Bootstrap. Each of my checkboxes has 14 choices with very short labels. My form:

$builder
    ->add('banks', 'entity', array(
                'class'         => 'AppBundle:Bank',
                'property'      => 'name',
                'multiple'      => true,
                'expanded'      => true,
                'required'      => false,
                'label'         => 'Banques',
          ))
    ->add('companies', 'entity', array(
                'class'         => 'AppBundle:Company',
                'property'      => 'name',
                'multiple'      => true,
                'expanded'      => true,
                'required'      => false,
                'label'         => 'Sociétés',
          ))
    ->add('search','submit', array('label'         => 'Filtrer'))
    ;

My view:

{{ form_start(form) }}

{{ form_row(form.banks) }}
<button type="button" class="btn btn-primary" id="check_banks">Cocher toutes les banques</button>
{{ form_row(form.companies) }}
<button type="button" class="btn btn-primary" id="check_companies">Cocher toutes les sociétés</button>
{{ form_end(form) }}

Should i try to find bootstrap form theme file and edit it or is there a more straightforward solution?




Aucun commentaire:

Enregistrer un commentaire