src/Form/ContactType.php line 19

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\PasswordType;
  8. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  9. use Symfony\Component\Form\Extension\Core\Type\TextType;
  10. use Symfony\Component\Validator\Constraints\NotBlank;
  11. use Symfony\Component\Validator\Constraints\IsTrue;
  12. use Symfony\Component\Validator\Constraints\Length;
  13. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  14. class ContactType extends AbstractType
  15. {
  16.     public function buildForm(FormBuilderInterface $builder, array $options): void
  17.     {
  18.         $builder
  19.             ->add('yourname'TextType::class, [
  20.                 'label'=>'Your Name',
  21.             ])
  22.             ->add('youremail'EmailType::class,  [
  23.                 'label'=>'Your Email'
  24.             ])
  25.             ->add('yourmessage'TextareaType::class,  [
  26.                 'label'=>'Your Message'
  27.             ])
  28.         ;
  29.     }
  30.     public function configureOptions(OptionsResolver $resolver): void
  31.     {
  32.         $resolver->setDefaults([
  33.             'data_class' => Contact::class,
  34.         ]);
  35.     }
  36. }