X-Git-Url: https://git.rapsys.eu/blogbundle/blobdiff_plain/ba6ed1d2d45b58011d275ef5960fdb012b9d0b94..2170a08e8b827db071883ad0b539a3ff97d6cd97:/Form/ContactType.php diff --git a/Form/ContactType.php b/Form/ContactType.php new file mode 100644 index 0000000..07c8eb0 --- /dev/null +++ b/Form/ContactType.php @@ -0,0 +1,40 @@ +add('name', TextType::class, array('attr' => array('placeholder' => 'Your name'), 'constraints' => array(new NotBlank(array("message" => "Please provide your name"))))) + ->add('subject', TextType::class, array('attr' => array('placeholder' => 'Subject'), 'constraints' => array(new NotBlank(array("message" => "Please give a Subject"))))) + ->add('email', EmailType::class, array('attr' => array('placeholder' => 'Your email address'), 'constraints' => array(new NotBlank(array("message" => "Please provide a valid email")), new Email(array("message" => "Your email doesn't seems to be valid"))))) + ->add('message', TextareaType::class, array('attr' => array('placeholder' => 'Your message here', 'cols' => 50, 'rows' => 15), 'constraints' => array(new NotBlank(array("message" => "Please provide a message here"))))) + ->add('submit', SubmitType::class, array('label' => 'Send', 'attr' => array('class' => 'submit'))); + } + + /** + * {@inheritdoc} + */ + public function setDefaultOptions(OptionsResolver $resolver) { + $resolver->setDefaults(array('error_bubbling' => true)); + } + + /** + * {@inheritdoc} + */ + public function getName() { + return 'contact_form'; + } +}