<?php
namespace App\Form;
use App\Dictionary\ReviewTypeForm;
use App\Entity\ReviewComment;
use App\Repository\ReviewServiceAreaRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
/**
* Formularz kontaktowy
*/
class ContactForm extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('signature', TextType::class, array(
'label' => 'Podpis',
'required' => true,
'constraints' => [
new NotBlank([
'message' => 'To pole nie może być puste'
]),
new Length([
'min' => 3,
'max' => 50,
'minMessage' => 'Minimalna liczba znaków wynosi 3',
'maxMessage' => 'Maksymalna liczna znaków wynosi 50'
])
],
'attr' =>
array(
'maxlength' => 50,
'placeholder' => 'podpis',
'class' => 'form-control'
)
))
->add('email', EmailType::class, array(
'label' => 'twój adres e-mail',
'required' => false,
'constraints' => [
new NotBlank([
'message' => 'To pole nie może być puste'
]),
new Email([
'message' => 'Niepoprawny adres e-mail'
])
],
'attr' =>
array(
'maxlength' => 150,
'placeholder' => 'e-mail',
'class' => 'form-control'
)
))
->add('description', TextareaType::class, array(
'label' => false,
'required' => true,
'constraints' => [
new NotBlank([
'message' => 'To pole nie może być puste'
]),
new Length([
'min' => 10,
'max' => 5000,
'minMessage' => 'Minimalna liczba znaków wynosi 10',
'maxMessage' => 'Maksymalna liczna znaków wynosi 5000'
])
],
'attr' =>
array(
'maxlength' => 5000,
'class' => 'form-control',
'rows' => 10,
'placeholder' => 'treść wiadomości'
)
))
->add('save', SubmitType::class, array(
'label' => 'Wyślij',
'attr' =>
array(
'class' => 'g-recaptcha btn-primary',
'data-sitekey' => "6LdJaoAlAAAAAFiu2MBDOKF4czKzGHV9W_I05Wmv",
'data-callback' => "onSubmit",
'data-action' => "submit"
)
));
}
}