1 | <?php |
||
40 | class FormViewHelperService implements SingletonInterface |
||
41 | { |
||
42 | /** |
||
43 | * @var bool |
||
44 | */ |
||
45 | protected $formContext = false; |
||
46 | |||
47 | /** |
||
48 | * @var FormObject |
||
49 | */ |
||
50 | protected $formObject; |
||
51 | |||
52 | /** |
||
53 | * @var Request |
||
54 | */ |
||
55 | protected $request; |
||
56 | |||
57 | /** |
||
58 | * @var Result |
||
59 | */ |
||
60 | protected $result; |
||
61 | |||
62 | /** |
||
63 | * Reset every state that can be used by this service. |
||
64 | */ |
||
65 | public function resetState() |
||
71 | |||
72 | /** |
||
73 | * Will activate the form context, changing the result returned by the |
||
74 | * function `formContextExists()`. |
||
75 | * |
||
76 | * @return FormViewHelperService |
||
77 | * @throws DuplicateEntryException |
||
78 | */ |
||
79 | public function activateFormContext() |
||
90 | |||
91 | /** |
||
92 | * Returns `true` if the `FormViewHelper` context exists. |
||
93 | * |
||
94 | * @return bool |
||
95 | */ |
||
96 | public function formContextExists() |
||
100 | |||
101 | /** |
||
102 | * Will loop on the submitted form fields and apply behaviours if their |
||
103 | * configuration contains. |
||
104 | */ |
||
105 | public function applyBehavioursOnSubmittedForm() |
||
129 | |||
130 | /** |
||
131 | * Takes care of injecting data for the form. |
||
132 | * |
||
133 | * If the form was generated using a content object, information about it |
||
134 | * are injected, to be retrieved later to be able for instance to fetch the |
||
135 | * object settings (TypoScript, FlexForm, ...). |
||
136 | */ |
||
137 | public function injectFormRequestData() |
||
155 | |||
156 | /** |
||
157 | * @todo |
||
158 | * |
||
159 | * @param DataAttributesAssetHandler $dataAttributesAssetHandler |
||
160 | * @return array |
||
161 | */ |
||
162 | public function getDataAttributes(DataAttributesAssetHandler $dataAttributesAssetHandler) |
||
189 | |||
190 | /** |
||
191 | * Checks if the form uses steps, in which case the current step is needed |
||
192 | * in order to display the form. If the step is not found, an exception is |
||
193 | * thrown. |
||
194 | */ |
||
195 | public function checkStepDefinition() |
||
203 | |||
204 | /** |
||
205 | * Will check all the fields that have been added below the form view |
||
206 | * helper: each field that is found in the form definition and is *not* |
||
207 | * supported by the current step will add an error and cancel the form |
||
208 | * rendering. |
||
209 | * |
||
210 | * @param ViewHelperVariableContainer $variableContainer |
||
211 | */ |
||
212 | public function checkStepFields(ViewHelperVariableContainer $variableContainer) |
||
245 | |||
246 | /** |
||
247 | * Returns the list of fields that have been added below the form view |
||
248 | * helper. |
||
249 | * |
||
250 | * @param ViewHelperVariableContainer $variableContainer |
||
251 | * @return array |
||
252 | */ |
||
253 | public function getCurrentFormFieldNames(ViewHelperVariableContainer $variableContainer) |
||
275 | |||
276 | /** |
||
277 | * @param string $formName |
||
278 | * @return AbstractFormValidator |
||
279 | */ |
||
280 | protected function getFormValidator($formName) |
||
293 | |||
294 | /** |
||
295 | * @return Step|null |
||
296 | */ |
||
297 | public function getCurrentStep() |
||
301 | |||
302 | /** |
||
303 | * @return FormObject |
||
304 | */ |
||
305 | public function getFormObject() |
||
309 | |||
310 | /** |
||
311 | * @param FormObject $formObject |
||
312 | */ |
||
313 | public function setFormObject(FormObject $formObject) |
||
317 | |||
318 | /** |
||
319 | * @param Request $request |
||
320 | */ |
||
321 | public function setRequest(Request $request) |
||
325 | |||
326 | /** |
||
327 | * @return Result |
||
328 | */ |
||
329 | public function getResult() |
||
333 | } |
||
334 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.