<?php
namespace App\Form;
use App\Entity\Contact;
use EasyCorp\Bundle\EasyAdminBundle\Field\TelephoneField;
use Misd\PhoneNumberBundle\Form\Type\PhoneNumberType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TelType;
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)
{
$builder
->add('name',TextType::class,[
'required' => true
])
->add('email', EmailType::class, [
'required' => true
])
->add('phone', TelType::class, [
'required' => true,
'label' => false
])
->add('subject',TextType::class, [
'required' => true
])
->add('content', TextareaType::class, [
'required' => true
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Contact::class,
'action' => '/contact/send',
'attr' => [
'id' => 'form_contact_id'
]
]);
}
}