lundi 12 février 2018

how to change the order of checkbox and label name in symfony formbuilder

I have a list of checkboxes in my symfony project. Formbuilder by default set first checkbox and after them label_name. Is there a way to change this sequence ? I tried to add the pull-right class to the input and it did not work.

public function buildForm(FormBuilderInterface $builder, array $options) {
    $builder
        ->add('studentId', EntityType::class,
            array(
                'class' => 'AppBundle:Student',
                'choice_label'=> 'name',
                'choice_attr' => function($val, $key, $index){
                    return ['data-toggle' => 'toggle', 'data-on' => 'present', 'data-off' => 'absent'];
                },
                'multiple' => true,
                'expanded' => true,
            ))
        ->add('start', SubmitType::class,
            array(
                'label' => 'Submit',
                'attr' => array('class' => 'btn btn-info btn-lg center-block')
            ));
}

<div class="row">
    
    <div class="col-md-4 col-md-offset-4">
        
    </div>
    
    
</div>




Aucun commentaire:

Enregistrer un commentaire