1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace App\Form;
- use App\Config\View;
- use App\Entity\Profile;
- use Symfony\Component\Form\AbstractType;
- use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
- use Symfony\Component\Form\Extension\Core\Type\SubmitType;
- use Symfony\Component\Form\FormBuilderInterface;
- use Symfony\Component\OptionsResolver\OptionsResolver;
- class ProfileType extends AbstractType
- {
- public function buildForm(FormBuilderInterface $builder, array $options): void
- {
- $builder
- ->add('view', ChoiceType::class, [
- 'expanded' => true,
- 'multiple' => false,
- 'choices' => [
- 'Liste' => View::TABLEAU,
- 'Vignette' => View::VIGNETTE
- ],
- 'label_attr' => [
- 'class' => 'pt-0'
- ]
- ])
- ->add('save', SubmitType::class, [
- 'label' => 'Enregistrer',
- 'row_attr' => [
- 'class' => 'mb-3'
- ]
- ])
- ;
- }
- public function configureOptions(OptionsResolver $resolver): void
- {
- $resolver->setDefaults([
- 'data_class' => Profile::class,
- ]);
- }
- }
|