1 | <?php |
||
18 | abstract class GenericFormElement extends AbstractElement implements FormElement |
||
19 | { |
||
20 | /** |
||
21 | * @var \Symfony\Component\Form\FormFactoryInterface |
||
22 | */ |
||
23 | protected $formFactory; |
||
24 | |||
25 | /** |
||
26 | * {@inheritdoc} |
||
27 | */ |
||
28 | public function getRoute() |
||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | */ |
||
36 | public function configureOptions(OptionsResolver $resolver) |
||
37 | { |
||
38 | $resolver->setDefaults([ |
||
39 | 'template_form' => null, |
||
40 | 'allow_add' => true |
||
41 | ]); |
||
42 | |||
43 | $resolver->setAllowedTypes('template_form', ['null', 'string']); |
||
44 | $resolver->setAllowedTypes('allow_add', 'bool'); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | public function setFormFactory(FormFactoryInterface $factory) |
||
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | */ |
||
58 | public function createForm($data = null) |
||
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | public function getSuccessRoute() |
||
76 | |||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | */ |
||
80 | public function getSuccessRouteParameters() |
||
84 | |||
85 | /** |
||
86 | * Initialize create Form. This form will be used in createAction in FormController. |
||
87 | * |
||
88 | * @param \Symfony\Component\Form\FormFactoryInterface $factory |
||
89 | * @param mixed $data |
||
90 | * @return \Symfony\Component\Form\FormInterface |
||
91 | */ |
||
92 | abstract protected function initForm(FormFactoryInterface $factory, $data = null); |
||
93 | } |
||
94 |