File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -70,10 +70,19 @@ public function createFormArray(
7070 $ form ['#open ' ] = $ definition ->getOptionsValue ('open ' , TRUE );
7171 }
7272
73+ if ((!$ formState ->isCached () || $ definition ->isReadOnly ())) {
74+ $ items = $ definition ->getConst () ?? $ formState ->getTemporaryValue ($ definition ->getPropertyPath ())
75+ ?? $ definition ->getDefault ();
76+ if (is_array ($ items )) {
77+ $ items = array_map (fn ($ item ) => $ item instanceof \stdClass ? (array ) $ item : $ item , $ items );
78+ $ formState ->setTemporaryValue ($ definition ->getPropertyPath (), $ items );
79+ }
80+ }
81+
7382 $ propertyAccessor = FormStatePropertyAccessor::create ($ formState , $ definition ->getPropertyFormParents ());
7483 $ numItems = $ propertyAccessor ->getProperty ('numItems ' );
7584 if (NULL === $ numItems ) {
76- $ items = $ formState ->getTemporaryValue ($ definition ->getPropertyPath ());
85+ $ items ?? = $ formState ->getTemporaryValue ($ definition ->getPropertyPath ());
7786 $ numItems = is_array ($ items ) ? count ($ items ) : ($ definition ->getMinItems () ?? 0 );
7887 $ propertyAccessor ->setProperty ('numItems ' , $ numItems );
7988 }
You can’t perform that action at this time.
0 commit comments