<?php namespace App\Form;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type as Type;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;
class ContactType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name', TextType::class, [
'label' => 'Imię i Nazwisko *',
'constraints' => new NotBlank(),
])
->add('email', EmailType::class, [
'label' => 'E-mail *',
'constraints' => [
new NotBlank(),
new Email(),
],
])
->add('content', TextareaType::class, [
'label' => 'Wiadomość *',
'constraints' => new NotBlank(),
])
;
}
public function getBlockPrefix(): string
{
return 'contact';
}
}