66use AppBundle \Entity \WebformComponent ;
77use EWZ \Bundle \RecaptchaBundle \Form \Type \EWZRecaptchaType ;
88use Mdespeuilles \MarkupFieldBundle \Form \Type \MarkupType ;
9+ use Mdespeuilles \WebformBundle \Form \Type \RecaptchaSubmitType ;
910use Sonata \CoreBundle \Form \Type \BooleanType ;
1011use Symfony \Component \Form \AbstractType ;
1112use Symfony \Component \Form \Extension \Core \Type \CheckboxType ;
@@ -40,7 +41,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
4041 ],
4142 'label ' => $ component ->getName ()
4243 ];
43-
44+
4445 if ($ component ->getType () == MarkupType::class) {
4546 $ componentOptions ['label ' ] = false ;
4647 $ componentOptions ['markup ' ] = $ component ->getName ();
@@ -54,16 +55,21 @@ public function buildForm(FormBuilderInterface $builder, array $options)
5455 }
5556
5657 if ($ webform ->isUseCaptcha ()) {
57- $ builder ->add ('recaptcha ' , EWZRecaptchaType::class, [
58+ /* $builder->add('recaptcha', EWZRecaptchaType::class, [
5859 "required" => true,
5960 "label" => false,
6061 "mapped" => false
62+ ]);*/
63+
64+ $ builder ->add ('captcha ' , RecaptchaSubmitType::class, [
65+ 'label ' => $ webform ->getSubmitString (),
66+ ]);
67+ }
68+ else {
69+ $ builder ->add ('submit ' , SubmitType::class, [
70+ 'label ' => $ webform ->getSubmitString ()
6171 ]);
6272 }
63-
64- $ builder ->add ('submit ' , SubmitType::class, [
65- 'label ' => $ webform ->getSubmitString ()
66- ]);
6773 }
6874
6975 /**
@@ -73,7 +79,8 @@ public function configureOptions(OptionsResolver $resolver)
7379 {
7480 $ resolver ->setDefaults (array (
7581 'data_class ' => 'Mdespeuilles\WebformBundle\Entity\WebformComponent ' ,
76- 'webform ' => null
82+ 'webform ' => null ,
83+ "allow_extra_fields " => true
7784 ));
7885 }
7986
0 commit comments