src/Form/App/ContactType.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Form\App;
  3. use App\Entity\App\Contact;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  6. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  8. use Symfony\Component\Form\Extension\Core\Type\TextType;
  9. use Symfony\Component\Form\FormBuilderInterface;
  10. use Symfony\Component\OptionsResolver\OptionsResolver;
  11. class ContactType extends AbstractType
  12. {
  13.     public function buildForm(FormBuilderInterface $builder, array $options): void
  14.     {
  15.         $builder
  16.             ->add('name'TextType::class, [
  17.                 'label' => "Nom d'utlisateur",
  18.                 'attr' => [
  19.                     'class' => 'form-field form-input',
  20.                 ],
  21.             ])
  22.             ->add(
  23.                 'email',
  24.                 EmailType::class,
  25.                 [
  26.                     'label' => 'Adresse e-mail',
  27.                     'attr' => [
  28.                         'class' => 'form-field form-input',
  29.                     ],
  30.                 ]
  31.             )
  32.             ->add(
  33.                 'object',
  34.                 TextType::class,
  35.                 [
  36.                     'label' => 'Objet',
  37.                     'attr' => [
  38.                         'class' => 'form-field form-input',
  39.                     ],
  40.                 ]
  41.             )
  42.             ->add(
  43.                 'message',
  44.                 TextareaType::class,
  45.                 [
  46.                     'label' => 'Message',
  47.                     'attr' => [
  48.                         'class' => 'form-field form-input',
  49.                     ],
  50.                 ]
  51.             )
  52.             ->add('category'ChoiceType::class, [
  53.                 'choices' => [
  54.                     'SAV' => 0,
  55.                     'Personnalisation' => 1,
  56.                 ],
  57.                 'label' => 'Catégorie',
  58.                 'attr' => [
  59.                     'class' => 'form-field form-input',
  60.                 ],
  61.             ]);
  62.     }
  63.     public function configureOptions(OptionsResolver $resolver): void
  64.     {
  65.         $resolver->setDefaults([
  66.             'data_class' => Contact::class,
  67.         ]);
  68.     }
  69. }