<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
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
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TextType::class, [
"label" => "contact.name"
])
->add('email', TextType::class, [
"label" => "contact.email"
])
->add('phone', TextType::class, [
"label" => "contact.phone"
])
->add('message', TextareaType::class, [
"label" => "contact.message"
]);
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'translation_domain' => 'messages',
'data_class' => 'App\Entity\Contact'
));
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'contactbundle_contact';
}
}