We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1595a0 commit fc7155eCopy full SHA for fc7155e
src/Form/Control/ArrayArrayFactory.php
@@ -85,6 +85,16 @@ public function createFormArray(
85
);
86
87
if (0 === $numItems) {
88
+ if (0 !== $definition->getMaxItems()) {
89
+ // There might be a file field in the child elements. To ensure that the
90
+ // form is sent as multipart/form-data in case a file field is
91
+ // dynamically added, we claim that the form has a file element.
92
+ // If there's no file field initially, the form would be sent as
93
+ // application/x-www-form-urlencoded, i.e. file contents wouldn't be
94
+ // submitted.
95
+ $formState->setHasFileElement(TRUE);
96
+ }
97
+
98
// Ensure we get an empty array if there's no item.
99
$form[] = [
100
'#type' => 'hidden',
0 commit comments