src/Form/ContactType.php line 12

Open in your IDE?
  1. <?php namespace App\Form;
  2. use Symfony\Component\Form\Extension\Core\Type\TextType;
  3. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  4. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\Extension\Core\Type as Type;
  7. use Symfony\Component\Form\FormBuilderInterface;
  8. use Symfony\Component\Validator\Constraints\Email;
  9. use Symfony\Component\Validator\Constraints\NotBlank;
  10. class ContactType extends AbstractType
  11. {
  12.     public function buildForm(FormBuilderInterface $builder, array $options): void
  13.     {
  14.         $builder
  15.             ->add('name'TextType::class, [
  16.                 'label' => 'Imię i Nazwisko *',
  17.                 'constraints' => new NotBlank(),
  18.             ])
  19.             ->add('email'EmailType::class, [
  20.                 'label' => 'E-mail *',
  21.                 'constraints' => [
  22.                     new NotBlank(),
  23.                     new Email(),
  24.                 ],
  25.             ])
  26.             ->add('content'TextareaType::class, [
  27.                 'label' => 'Wiadomość *',
  28.                 'constraints' => new NotBlank(),
  29.             ])
  30.         ;
  31.     }
  32.     public function getBlockPrefix(): string
  33.     {
  34.         return 'contact';
  35.     }
  36. }