<?php
namespace App\Form;
use App\Entity\ContactUs;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
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', null, [
'row_attr' => [
'class' => 'col-sm-6',
],
'attr' => [
'placeholder' => 'Enter name',
],
])
->add('email', EmailType::class, [
'row_attr' => [
'class' => 'col-sm-6',
],
'attr' => [
'placeholder' => 'Enter email',
],
])
->add('phone', null, [
'row_attr' => [
'class' => 'col-sm-6',
],
'attr' => [
'placeholder' => 'Enter phone',
],
])
->add('subject', ChoiceType::class, [
'choices' => [
'Select a Subject' => '',
'web' => 'web',
'graphic' => 'graphic',
'video' => 'video',
],
'row_attr' => [
'class' => 'col-sm-6',
],
])
->add('message', null, [
'attr' => [
'placeholder' => 'Enter your message',
],
])
->add('captcha', ReCaptchaType::class, [
'mapped' => false,
'type' => 'invisible',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => ContactUs::class,
]);
}
}