@@ 13-53 (lines=41) @@ | ||
10 | /** |
|
11 | * The type for the BooleanFormSubmissionField |
|
12 | */ |
|
13 | class BooleanFormSubmissionType extends AbstractType |
|
14 | { |
|
15 | /** |
|
16 | * @param FormBuilderInterface $builder The form builder |
|
17 | * @param array $options The options |
|
18 | */ |
|
19 | public function buildForm(FormBuilderInterface $builder, array $options) |
|
20 | { |
|
21 | if (isset($options['value_constraints']) && !empty($options['value_constraints'])) { |
|
22 | $options['constraints'] = $options['value_constraints']; |
|
23 | } |
|
24 | ||
25 | $keys = array_fill_keys(['label', 'required', 'constraints'], null); |
|
26 | $fieldOptions = array_filter( |
|
27 | array_replace($keys, array_intersect_key($options, $keys)), |
|
28 | function ($v) { |
|
29 | return isset($v); |
|
30 | } |
|
31 | ); |
|
32 | ||
33 | $builder->add('value', CheckboxType::class, $fieldOptions); |
|
34 | } |
|
35 | ||
36 | public function configureOptions(OptionsResolver $resolver) |
|
37 | { |
|
38 | $resolver->setDefaults( |
|
39 | [ |
|
40 | 'data_class' => 'Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\BooleanFormSubmissionField', |
|
41 | 'value_constraints' => [], |
|
42 | ] |
|
43 | ); |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * @return string |
|
48 | */ |
|
49 | public function getBlockPrefix() |
|
50 | { |
|
51 | return 'kunstmaan_formbundle_booleanformsubmissiontype'; |
|
52 | } |
|
53 | } |
|
54 |
@@ 13-52 (lines=40) @@ | ||
10 | /** |
|
11 | * The type for the EmailFormSubmissionField |
|
12 | */ |
|
13 | class EmailFormSubmissionType extends AbstractType |
|
14 | { |
|
15 | /** |
|
16 | * @param FormBuilderInterface $builder The form builder |
|
17 | * @param array $options The options |
|
18 | */ |
|
19 | public function buildForm(FormBuilderInterface $builder, array $options) |
|
20 | { |
|
21 | if (isset($options['value_constraints']) && !empty($options['value_constraints'])) { |
|
22 | $options['constraints'] = $options['value_constraints']; |
|
23 | } |
|
24 | ||
25 | $keys = array_fill_keys(['label', 'required', 'constraints'], null); |
|
26 | $fieldOptions = array_filter( |
|
27 | array_replace($keys, array_intersect_key($options, $keys)), |
|
28 | function ($v) { |
|
29 | return isset($v); |
|
30 | } |
|
31 | ); |
|
32 | $builder->add('value', EmailType::class, $fieldOptions); |
|
33 | } |
|
34 | ||
35 | public function configureOptions(OptionsResolver $resolver) |
|
36 | { |
|
37 | $resolver->setDefaults( |
|
38 | [ |
|
39 | 'data_class' => 'Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\EmailFormSubmissionField', |
|
40 | 'value_constraints' => [], |
|
41 | ] |
|
42 | ); |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @return string |
|
47 | */ |
|
48 | public function getBlockPrefix() |
|
49 | { |
|
50 | return 'kunstmaan_formbundle_emailformsubmissiontype'; |
|
51 | } |
|
52 | } |
|
53 |
@@ 13-53 (lines=41) @@ | ||
10 | /** |
|
11 | * This class represents the type for the file FileFormSubmissionField |
|
12 | */ |
|
13 | class FileFormSubmissionType extends AbstractType |
|
14 | { |
|
15 | /** |
|
16 | * @param FormBuilderInterface $builder The form builder |
|
17 | * @param array $options An array with options |
|
18 | */ |
|
19 | public function buildForm(FormBuilderInterface $builder, array $options) |
|
20 | { |
|
21 | if (isset($options['value_constraints']) && !empty($options['value_constraints'])) { |
|
22 | $options['constraints'] = $options['value_constraints']; |
|
23 | } |
|
24 | ||
25 | $keys = array_fill_keys(['label', 'required', 'constraints'], null); |
|
26 | $fieldOptions = array_filter( |
|
27 | array_replace($keys, array_intersect_key($options, $keys)), |
|
28 | function ($v) { |
|
29 | return isset($v); |
|
30 | } |
|
31 | ); |
|
32 | ||
33 | $builder->add('file', FileType::class, $fieldOptions); |
|
34 | } |
|
35 | ||
36 | public function configureOptions(OptionsResolver $resolver) |
|
37 | { |
|
38 | $resolver->setDefaults( |
|
39 | [ |
|
40 | 'data_class' => 'Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\FileFormSubmissionField', |
|
41 | 'value_constraints' => [], |
|
42 | ] |
|
43 | ); |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * @return string |
|
48 | */ |
|
49 | public function getBlockPrefix() |
|
50 | { |
|
51 | return 'kunstmaan_formbundle_fileformsubmissiontype'; |
|
52 | } |
|
53 | } |
|
54 |
@@ 13-52 (lines=40) @@ | ||
10 | /** |
|
11 | * The type for the StringFormSubmissionField |
|
12 | */ |
|
13 | class StringFormSubmissionType extends AbstractType |
|
14 | { |
|
15 | /** |
|
16 | * @param FormBuilderInterface $builder The form builder |
|
17 | * @param array $options The options |
|
18 | */ |
|
19 | public function buildForm(FormBuilderInterface $builder, array $options) |
|
20 | { |
|
21 | if (isset($options['value_constraints']) && !empty($options['value_constraints'])) { |
|
22 | $options['constraints'] = $options['value_constraints']; |
|
23 | } |
|
24 | ||
25 | $keys = array_fill_keys(['label', 'required', 'constraints'], null); |
|
26 | $fieldOptions = array_filter( |
|
27 | array_replace($keys, array_intersect_key($options, $keys)), |
|
28 | function ($v) { |
|
29 | return isset($v); |
|
30 | } |
|
31 | ); |
|
32 | $builder->add('value', TextType::class, $fieldOptions); |
|
33 | } |
|
34 | ||
35 | public function configureOptions(OptionsResolver $resolver) |
|
36 | { |
|
37 | $resolver->setDefaults( |
|
38 | [ |
|
39 | 'data_class' => 'Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\StringFormSubmissionField', |
|
40 | 'value_constraints' => [], |
|
41 | ] |
|
42 | ); |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @return string |
|
47 | */ |
|
48 | public function getBlockPrefix() |
|
49 | { |
|
50 | return 'kunstmaan_formbundle_stringformsubmissiontype'; |
|
51 | } |
|
52 | } |
|
53 |