I have a formType that contains an EntityType :: class. This is a list of possible types of users to choose from in a form.
->add('typeUser',EntityType::class, array(
'required' => true,
'class'=>'Site\PagesBundle\Entity\TypeUser',
'choice_label'=>'typeUtilisateur',
'expanded'=>true,
'multiple'=>true,
'empty_data' => 'Veuillez sélectionner au moins 1 type',
));
I wish I could give a "style" to these choices. For example, I would like them to be some distance from the checkbox.
So, I have to add style (margin-left by example) to :
'choice_label'=>'typeUtilisateur',
Is it possible in FormType ?
Or I should make that on my twig file ? In this case, how can I do it ?
Thanks for your help !
EDIT:
->add('typeUser',EntityType::class, array(
'required' => true,
'class'=>'Site\PagesBundle\Entity\TypeUser',
'choice_label'=>('typeUtilisateur' => 'attr' => array( 'style' => 'margin-left:15px')) ,
'expanded'=>true,
'multiple'=>true,
'empty_data' => 'Veuillez sélectionner au moins 1 type',
));