File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,18 @@ protected function getFieldStates($fields)
207207 {
208208 $ states = [];
209209 foreach ($ fields as $ field ) {
210- $ states [] = $ field ->getSchemaState ();
210+ $ fieldState = $ field ->getSchemaState ();
211+
212+ // getSchema() allows fields to contain nested schema for their children.
213+ // The PHPDoc for getState says it should too - but it doesn't, and there are
214+ // backwards compatibility concerns with allowing that with the "children" array key.
215+ // Allow a special "child-state-to-fold-in" for nested data instead.
216+ if (isset ($ fieldState ['child-state-to-fold-in ' ])) {
217+ $ states = array_merge ($ states , $ fieldState ['child-state-to-fold-in ' ]);
218+ unset($ fieldState ['child-state-to-fold-in ' ]);
219+ }
220+
221+ $ states [] = $ fieldState ;
211222
212223 if ($ field instanceof CompositeField) {
213224 $ subFields = $ field ->FieldList ();
You can’t perform that action at this time.
0 commit comments