@@ -92,7 +92,7 @@ public function initializeForm(array $data): array
92
92
}
93
93
94
94
// set the formValues from the initial form view's data
95
- $ this ->formValues = $ this ->extractFormValues ($ this ->getForm (), $ this -> getFormInstance () );
95
+ $ this ->formValues = $ this ->extractFormValues ($ this ->getForm ());
96
96
97
97
return $ data ;
98
98
}
@@ -145,7 +145,7 @@ private function resetForm(): void
145
145
$ this ->shouldAutoSubmitForm = false ;
146
146
$ this ->formInstance = null ;
147
147
$ this ->formView = null ;
148
- $ this ->formValues = $ this ->extractFormValues ($ this ->getForm (), $ this -> getFormInstance () );
148
+ $ this ->formValues = $ this ->extractFormValues ($ this ->getForm ());
149
149
}
150
150
151
151
private function submitForm (bool $ validateAll = true ): void
@@ -172,7 +172,7 @@ private function submitForm(bool $validateAll = true): void
172
172
173
173
// re-extract the "view" values in case the submitted data
174
174
// changed the underlying data or structure of the form
175
- $ this ->formValues = $ this ->extractFormValues ($ this ->getForm (), $ form );
175
+ $ this ->formValues = $ this ->extractFormValues ($ this ->getForm ());
176
176
177
177
// remove any validatedFields that do not exist in data anymore
178
178
$ this ->validatedFields = LiveFormUtility::removePathsNotInData (
@@ -238,7 +238,7 @@ private function getDataModelValue(): ?string
238
238
* frontend, and it's meant to equal the raw POST data that would
239
239
* be sent if the form were submitted without modification.
240
240
*/
241
- private function extractFormValues (FormView $ formView, FormInterface $ form ): array
241
+ private function extractFormValues (FormView $ formView ): array
242
242
{
243
243
$ values = [];
244
244
@@ -250,10 +250,12 @@ private function extractFormValues(FormView $formView, FormInterface $form): arr
250
250
// is already correct. For example, an expanded ChoiceType with
251
251
// options "text" and "phone" would already have a value in the format
252
252
// ["text"] (assuming "text" is checked and "phone" is not).
253
- //
254
- $ isCompound = $ form ->has ($ name ) && $ form ->get ($ name )->getConfig ()->getOption ('compound ' , false );
253
+ // "compound" is how we know if a field holds children. The extra
254
+ // "compound_data" is a special flag to workaround the fact that
255
+ // the "autocomplete" library fakes their compound fake incorrectly.
256
+ $ isCompound = $ child ->vars ['compound_data ' ] ?? $ child ->vars ['compound ' ] ?? false ;
255
257
if ($ isCompound && !($ child ->vars ['expanded ' ] ?? false )) {
256
- $ values [$ name ] = $ this ->extractFormValues ($ child, $ form -> get ( $ name ) );
258
+ $ values [$ name ] = $ this ->extractFormValues ($ child );
257
259
258
260
continue ;
259
261
}
0 commit comments