src/Form/ContactType.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Contact;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use Symfony\Component\OptionsResolver\OptionsResolver;
  7. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  8. class ContactType extends AbstractType
  9. {
  10.     public function buildForm(FormBuilderInterface $builder, array $options): void
  11.     {
  12.         $builder
  13.             ->add('name'null, ['label' => false,'attr' => array('class' => 'form-control required')])
  14.             ->add('email'null, ['label' => false,'attr' => array('class' => 'required email form-control')])
  15.             ->add('phone'null, ['label' => false,'attr' => array('class' => 'form-control required')])
  16.             ->add('subject'null, ['label' => false,'attr' => array('class' => 'form-control required')])
  17.             ->add('message'TextareaType::class, ['label' => false,'attr' => array('class' => 'form-control required')])
  18.         ;
  19.     }
  20.     public function configureOptions(OptionsResolver $resolver): void
  21.     {
  22.         $resolver->setDefaults([
  23.             'data_class' => Contact::class,
  24.         ]);
  25.     }
  26. }