@@ 45-59 (lines=15) @@ | ||
42 | $this->urlGenerator = $urlGenerator; |
|
43 | } |
|
44 | ||
45 | public function buildForm(FormBuilderInterface $builder, array $options) |
|
46 | { |
|
47 | $builder |
|
48 | ->add('file', HiddenType::class, [ |
|
49 | 'attr' => array_key_exists('attr', $options) ? $options['attr'] : null, |
|
50 | ]) |
|
51 | ->addModelTransformer(new CallbackTransformer( |
|
52 | function ($value) { |
|
53 | return ['file' => $value]; |
|
54 | }, |
|
55 | function ($value) { |
|
56 | return $value['file']; |
|
57 | } |
|
58 | )); |
|
59 | } |
|
60 | ||
61 | public function buildView(FormView $view, FormInterface $form, array $options) |
|
62 | { |
@@ 21-35 (lines=15) @@ | ||
18 | ||
19 | class WysiwygType extends AbstractType |
|
20 | { |
|
21 | public function buildForm(FormBuilderInterface $builder, array $options) |
|
22 | { |
|
23 | $builder |
|
24 | ->add('wysiwyg', HiddenType::class, [ |
|
25 | 'attr' => array_key_exists('attr', $options) ? $options['attr'] : null, |
|
26 | ]) |
|
27 | ->addModelTransformer(new CallbackTransformer( |
|
28 | function ($value) { |
|
29 | return ['wysiwyg' => $value]; |
|
30 | }, |
|
31 | function ($value) { |
|
32 | return $value['wysiwyg']; |
|
33 | } |
|
34 | )); |
|
35 | } |
|
36 | } |
|
37 |