1 | <?php |
||
14 | class FormFactory |
||
15 | { |
||
16 | /** |
||
17 | * @var SymfonyFormFactory |
||
18 | */ |
||
19 | protected $formFactory; |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $configuration; |
||
25 | |||
26 | /** |
||
27 | * @var DataProvider[] |
||
28 | */ |
||
29 | protected $dataProviders = []; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $eventSubscribers = []; |
||
35 | |||
36 | /** |
||
37 | * @var HelpMessageProvider[] |
||
38 | */ |
||
39 | protected $helpMessageProviders = []; |
||
40 | |||
41 | /** |
||
42 | * @param SymfonyFormFactory $formFactory |
||
43 | */ |
||
44 | public function setFormFactory(SymfonyFormFactory $formFactory) |
||
48 | |||
49 | /** |
||
50 | * @param array $configuration |
||
51 | */ |
||
52 | public function setConfiguration(array $configuration) |
||
56 | |||
57 | /** |
||
58 | * @param string $alias |
||
59 | * @param DataProvider $dataProvider |
||
60 | */ |
||
61 | public function addDataProvider($alias, DataProvider $dataProvider) |
||
65 | |||
66 | /** |
||
67 | * @param string $alias |
||
68 | * @param HelpMessageProvider $helpMessageProvider |
||
69 | */ |
||
70 | public function addHelpMessageProvider($alias, HelpMessageProvider $helpMessageProvider) |
||
74 | |||
75 | /** |
||
76 | * @param string $formName |
||
77 | * @param EventSubscriberInterface $eventSubscriber |
||
78 | */ |
||
79 | public function addEventSubscriber($formName, EventSubscriberInterface $eventSubscriber) |
||
87 | |||
88 | /** |
||
89 | * @param string $key The key of the Form in the form configuration |
||
90 | * @param array $data |
||
91 | * @param array $options |
||
92 | * @param string $name An name for the form. If empty, the key will be used |
||
93 | * |
||
94 | * @return FormInterface |
||
95 | */ |
||
96 | public function createForm($key, $data = [], $options = [], $name = null) |
||
100 | |||
101 | /** |
||
102 | * This method generates a form based on the configuration file. |
||
103 | * |
||
104 | * @param string $key The key of the Form in the form configuration |
||
105 | * @param array $data |
||
106 | * @param array $options |
||
107 | * @param string $name An name for the form. If empty, the key will be used |
||
108 | * |
||
109 | * @return FormBuilderInterface |
||
110 | * |
||
111 | * @throws NonExistentFormException |
||
112 | */ |
||
113 | public function createBuilder($key, $data = [], $options = [], $name = null) |
||
172 | |||
173 | /** |
||
174 | * @param string $alias |
||
175 | * |
||
176 | * @return DataProvider |
||
177 | * |
||
178 | * @throws NotExistentDataProviderException |
||
179 | */ |
||
180 | public function loadDataProvider($alias) |
||
188 | |||
189 | /** |
||
190 | * @param string $alias |
||
191 | * |
||
192 | * @return HelpMessageProvider |
||
193 | * |
||
194 | * @throws NotExistentDataProviderException |
||
195 | */ |
||
196 | public function loadHelpMessageProvider($alias) |
||
204 | |||
205 | /** |
||
206 | * @param string $name |
||
207 | * |
||
208 | * @return array |
||
209 | * |
||
210 | * @throws NonExistentFormException |
||
211 | */ |
||
212 | public function getConfiguration($name = null) |
||
224 | |||
225 | /** |
||
226 | * Checks if a given form exists. |
||
227 | * |
||
228 | * @param string $name |
||
229 | * |
||
230 | * @return bool |
||
231 | */ |
||
232 | public function has($name) |
||
236 | } |
||
237 |