/**
  * @param WebForm $webForm
  *
  * @return \Symfony\Component\Form\Form
  */
 protected function getForm(WebForm $webForm)
 {
     $fb = $this->get('form.factory')->createNamedBuilder('web_form_' . $webForm->getName());
     $fb->setErrorBubbling(false);
     foreach ($webForm->getFields() as $field) {
         $fb->add($field->getName(), $field->getType(), ['required' => $field->getIsRequired()]);
     }
     if ($webForm->isIsUseCaptcha()) {
         $fb->add('captcha', 'genemu_captcha', ['mapped' => false]);
     }
     $fb->add('send', 'submit', ['attr' => ['class' => 'btn btn-success'], 'label' => $webForm->getSendButtonTitle()]);
     return $fb->getForm();
 }
 /**
  * @param WebForm $webForm
  *
  * @return \Symfony\Component\Form\Form
  */
 protected function getForm(WebForm $webForm)
 {
     $fb = $this->get('form.factory')->createNamedBuilder('web_form_' . $webForm->getName());
     $fb->setErrorBubbling(false);
     foreach ($webForm->getFields() as $field) {
         if (is_array($field->getParams())) {
             $options = $field->getParams();
         } else {
             $options = [];
         }
         $options['required'] = $field->getIsRequired();
         $options['label'] = $field->getTitle();
         if (isset($options['choices'])) {
             $options['choices'] = array_flip($options['choices']);
         }
         $type = $this->resolveTypeName($field->getType());
         $fb->add($field->getName(), $type, $options);
     }
     if ($webForm->isIsUseCaptcha()) {
         $fb->add('captcha', CaptchaType::class, ['mapped' => false]);
     }
     $fb->add('send', SubmitType::class, ['attr' => ['class' => 'btn btn-success'], 'label' => $webForm->getSendButtonTitle()]);
     return $fb->getForm();
 }