/**
  * Modify the form with the fields of the current page part
  *
  * @param FormBuilderInterface $formBuilder The form builder
  * @param ArrayObject          $fields      The fields
  * @param int                  $sequence    The sequence of the form field
  */
 public function adaptForm(FormBuilderInterface $formBuilder, ArrayObject $fields, $sequence)
 {
     $choices = explode("\n", $this->getChoices());
     $choices = array_map('trim', $choices);
     $cfsf = new ChoiceFormSubmissionField();
     $cfsf->setFieldName("field_" . $this->getUniqueId());
     $cfsf->setLabel($this->getLabel());
     $cfsf->setChoices($choices);
     $cfsf->setRequired($this->required);
     $cfsf->setSequence($sequence);
     $data = $formBuilder->getData();
     $data['formwidget_' . $this->getUniqueId()] = $cfsf;
     $constraints = array();
     if ($this->getRequired()) {
         $options = array();
         if (!empty($this->errorMessageRequired)) {
             $options['message'] = $this->errorMessageRequired;
         }
         $constraints[] = new NotBlank($options);
     }
     $formBuilder->add('formwidget_' . $this->getUniqueId(), new ChoiceFormSubmissionType(), array('label' => $this->getLabel(), 'required' => $this->getRequired(), 'expanded' => $this->getExpanded(), 'multiple' => $this->getMultiple(), 'choices' => $choices, 'placeholder' => $this->getEmptyValue(), 'constraints' => $constraints));
     $formBuilder->setData($data);
     $fields[] = $cfsf;
 }
 /**
  * @covers Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\ChoiceFormSubmissionField::__toString
  */
 public function testToString()
 {
     $stringValue = $this->object->__toString();
     $this->assertNotNull($stringValue);
     $this->assertTrue(is_string($stringValue));
 }