<?php
namespace App\Form\Web;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ContactType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name',TextType::class,[
'label' => 'contact.form.name',
'translation_domain' => 'web',
'required' => true,
'attr'=>[
'placeholder' => 'contact.form.name',
'class' => 'wpcf7-form-control wpcf7-text wpcf7-validates-as-required'
]
])
->add('email',EmailType::class,[
'label' => 'contact.form.email',
'translation_domain' => 'web',
'required' => true,
'attr' => [
'placeholder' => 'contact.form.email',
'class' => 'wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email'
]
])
->add('text',TextareaType::class,[
'label' => 'contact.form.text',
'translation_domain' => 'web',
'required' => true,
'attr'=>[
'placeholder' => 'contact.form.text',
'class' => 'wpcf7-form-control wpcf7-textarea',
'rows'=> 10
]
])
->add('website', TextType::class, [
'label' => false,
'mapped' => false,
'required' => false,
'attr' => [
'autocomplete' => 'off',
'tabindex' => '-1',
],
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
// Configure your form options here
]);
}
}