in my Symfony 4 project I would like to use this bootstrap theme for my checkbox :
HTML code :
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="customCheck1" checked="">
<label class="custom-control-label" for="customCheck1">Check this custom checkbox</label>
</div>
I managed to set it up on one of my fields when it's a CheckboxType :: class, like this:
->add('inscription', CheckboxType::class, [
'required' => false,
'label' => 'Activer l\'inscription',
'label_attr' => [
'class' => 'custom-control-label',
'for' => 'inscription'
],
'attr' => [
'class' => 'custom-control-input',
'id' => 'inscription'
]
])
And now I would like use it for Entity Type with multiple choices.
So I've :
->add('typesConges', EntityType::class, [
'class' => TypeConge::class,
'choice_label' => 'nom',
'choice_attr' => [
'class' => 'custom-control-input',
'id' => 'typesConges'
],
'attr' => [
'class' => 'custom-control-label',
'for' => 'typesConges'
],
'expanded' => true,
'multiple' => true,
])
But it doesn't work. I've this :
Can someone help me please ?
Aucun commentaire:
Enregistrer un commentaire