@@ -35,19 +35,28 @@ public function createForFormType(string $formType, array &$resources = []): Inp
35
35
36
36
$ inputDefinition = new InputDefinition ();
37
37
38
+ if (!$ form ->getConfig ()->getCompound ()) {
39
+ $ this ->addFormToInputDefinition ($ form ->getName (), $ form , $ inputDefinition );
40
+ }
41
+
38
42
foreach ($ form ->all () as $ name => $ field ) {
39
- if (!$ this ->isFormFieldSupported ($ field )) {
40
- continue ;
41
- }
43
+ $ this ->addFormToInputDefinition ($ name , $ field , $ inputDefinition );
44
+ }
42
45
43
- $ type = InputOption::VALUE_REQUIRED ;
44
- $ default = $ this ->resolveDefaultValue ($ field );
45
- $ description = FormUtil::label ($ field );
46
+ return $ inputDefinition ;
47
+ }
46
48
47
- $ inputDefinition ->addOption (new InputOption ($ name , null , $ type , $ description , $ default ));
49
+ private function addFormToInputDefinition (string $ name , FormInterface $ form , InputDefinition $ inputDefinition ): void
50
+ {
51
+ if (!$ this ->isFormFieldSupported ($ form )) {
52
+ return ;
48
53
}
49
54
50
- return $ inputDefinition ;
55
+ $ type = InputOption::VALUE_REQUIRED ;
56
+ $ default = $ this ->resolveDefaultValue ($ form );
57
+ $ description = FormUtil::label ($ form );
58
+
59
+ $ inputDefinition ->addOption (new InputOption ($ name , null , $ type , $ description , $ default ));
51
60
}
52
61
53
62
private function isFormFieldSupported (FormInterface $ field ): bool
0 commit comments