X-Git-Url: https://git.rapsys.eu/.gitweb.cgi/airbundle/blobdiff_plain/f6b5969a21df4fdaae5a5432a3f2127cdfc5de2a..1be898ed564b18e6ac635d4d605efd7a388991b3:/Form/ContactType.php diff --git a/Form/ContactType.php b/Form/ContactType.php index bb0ee77..2b8dd74 100644 --- a/Form/ContactType.php +++ b/Form/ContactType.php @@ -1,4 +1,13 @@ - + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Rapsys\AirBundle\Form; @@ -13,6 +22,9 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Validator\Constraints\Email; use Symfony\Component\Validator\Constraints\NotBlank; +/** + * {@inheritdoc} + */ class ContactType extends CaptchaType { /** * {@inheritdoc} @@ -20,10 +32,10 @@ class ContactType extends CaptchaType { public function buildForm(FormBuilderInterface $builder, array $options): void { //Add fields $builder - ->add('name', TextType::class, ['attr' => ['placeholder' => 'Your name'], 'constraints' => [new NotBlank(['message' => 'Please provide your name'])]]) - ->add('subject', TextType::class, ['attr' => ['placeholder' => 'Subject'], 'constraints' => [new NotBlank(['message' => 'Please provide your subject'])]]) - ->add('mail', EmailType::class, ['attr' => ['placeholder' => 'Your mail'], 'constraints' => [new NotBlank(['message' => 'Please provide a valid mail']), new Email(['message' => 'Your mail doesn\'t seems to be valid'])]]) - ->add('message', TextareaType::class, ['attr' => ['placeholder' => 'Your message', 'cols' => 50, 'rows' => 15], 'constraints' => [new NotBlank(['message' => 'Please provide your message'])]]) + ->add('name', TextType::class, ['attr' => ['placeholder' => 'Your name'], 'constraints' => [new NotBlank(null, 'Please provide your name')]]) + ->add('subject', TextType::class, ['attr' => ['placeholder' => 'Subject'], 'constraints' => [new NotBlank(null, 'Please provide your subject')]]) + ->add('mail', EmailType::class, ['attr' => ['placeholder' => 'Your mail'], 'constraints' => [new NotBlank(null, 'Please provide a valid mail'), new Email(null, 'Your mail doesn\'t seems to be valid')]]) + ->add('message', TextareaType::class, ['attr' => ['placeholder' => 'Your message', 'cols' => 50, 'rows' => 15], 'constraints' => [new NotBlank(null, 'Please provide your message')]]) ->add('submit', SubmitType::class, ['label' => 'Send', 'attr' => ['class' => 'submit']]); //Call parent @@ -33,7 +45,10 @@ class ContactType extends CaptchaType { /** * {@inheritdoc} */ - public function configureOptions(OptionsResolver $resolver) { + public function configureOptions(OptionsResolver $resolver): void { + //Call parent configure options + parent::configureOptions($resolver); + //Set defaults $resolver->setDefaults(['error_bubbling' => true]); } @@ -41,7 +56,7 @@ class ContactType extends CaptchaType { /** * {@inheritdoc} */ - public function getName() { + public function getName(): string { return 'contact_form'; } }