<?php
declare(strict_types=1);
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\IsTrue;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
class MediaFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name', TextType::class, [
'label' => 'app.general.gemini.mediaform.name',
'required' => true,
'constraints' => [
new NotBlank(),
new Length(['min' => 3]),
],
])
->add('surname', TextType::class, [
'label' => 'app.general.gemini.mediaform.surname',
'required' => true,
'constraints' => [
new NotBlank(),
new Length(['min' => 3]),
],
])
->add('email', TextType::class, [
'label' => 'app.general.gemini.mediaform.email',
'required' => true,
'constraints' => [
new NotBlank(),
new Length(['min' => 3]),
],
])
->add('phone', TextType::class, [
'label' => 'app.general.gemini.mediaform.phone',
'required' => false,
])
->add('company', TextType::class, [
'label' => 'app.general.gemini.mediaform.company',
'required' => false,
])
->add('topic', TextType::class, [
'label' => 'app.general.gemini.mediaform.topic',
'required' => false,
])
->add('message', TextType::class, [
'label' => 'app.general.gemini.mediaform.message',
'required' => true,
'constraints' => [
new NotBlank(),
new Length(['min' => 3]),
],
])
->add('agreement1', CheckboxType::class, [
'label' => 'app.general.gemini.mediaform.agreement1',
'required' => true,
'constraints' => [
new IsTrue([
'message' => 'app.general.gemini.form.checkboxvalidation',
]),
],
])
->add('_submit', SubmitType::class, [
'label' => 'app.general.gemini.mediaform.submit',
'attr' => [
'class' => 'col-5 primary-btn orange-btn',
],
]);
}
}