<?php
namespace App\Form\Front;
use App\Entity\Accommodation;
use App\Entity\ContactMessage;
use EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaType;
use EWZ\Bundle\RecaptchaBundle\Validator\Constraints\IsTrue as RecaptchaTrue;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Routing\RouterInterface;
class ContactInvestorType extends AbstractType
{
private $router;
public function __construct(RouterInterface $router)
{
$this->router = $router;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('recaptcha', EWZRecaptchaType::class, [
'attr' => [
'options' => [
'theme' => 'light',
'type' => 'image',
'size' => 'small',
]
],
'mapped' => false,
'constraints' => array(
new RecaptchaTrue()
)
])
->add('firstname', TextType::class, array('attr' => ['placeholder' => 'label.firstname']))
->add('lastname', TextType::class, array('attr' => ['placeholder' => 'label.lastname']))
->add('email', EmailType::class, array('attr' => ['placeholder' => 'label.email']))
->add('phone', TextType::class, array('attr' => ['placeholder' => 'label.phone']))
->add('optin', CheckboxType::class, array('label' => 'label.acceptOptin', 'required' => true))
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => ContactMessage::class,
'translation_domain' => 'front',
'type' => '',
));
}
}