src/Form/CustomerInformationType.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\CustomerInformation;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  6. use Symfony\Component\Form\FormBuilderInterface;
  7. use Symfony\Component\OptionsResolver\OptionsResolver;
  8. class CustomerInformationType extends AbstractType
  9. {
  10.     public function buildForm(FormBuilderInterface $builder, array $options): void
  11.     {
  12.         $builder
  13.             ->add('company'null, [
  14.                 'label' => 'Société *',
  15.                 'required' => true,
  16.                 'attr' => [
  17.                     'class' => 'form-control',
  18.                 ],
  19.             ])
  20.             ->add('name'null, [
  21.                 'label' => 'Nom et prénom *',
  22.                 'required' => true,
  23.                 'attr' => [
  24.                     'class' => 'form-control',
  25.                 ],
  26.             ])
  27.             ->add('email'EmailType::class, [
  28.                 'label' => 'Email *',
  29.                 'required' => true,
  30.                 'attr' => [
  31.                     'class' => 'form-control',
  32.                     'placeholder' => 'email@exemple.com',
  33.                     'autocomplete' => 'email',
  34.                 ],
  35.             ])
  36.         ;
  37.     }
  38.     public function configureOptions(OptionsResolver $resolver): void
  39.     {
  40.         $resolver->setDefaults([
  41.             'data_class' => CustomerInformation::class,
  42.         ]);
  43.     }
  44. }