File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,27 @@ private function repeaterHydrate($record, $app)
113113 }
114114 }
115115 }
116+
117+ /**
118+ *Fix for field type blocks
119+ */
120+ if (isset ($ contentType ['fields ' ][$ key ]) && $ contentType ['fields ' ][$ key ]['type ' ] === 'block ' && $ value !== null ) {
121+ $ originalMapping =[];
122+ $ originalMapping [$ key ]['fields ' ] = $ contentType ['fields ' ][$ key ]['fields ' ];
123+ $ originalMapping [$ key ]['type ' ] = 'block ' ;
124+ $ mapping = $ app ['storage.metadata ' ]->getRepeaterMapping ($ originalMapping );
125+ $ record [$ key ] = new RepeatingFieldCollection ($ app ['storage ' ], $ mapping );
126+ foreach ($ value as $ group => $ block ) {
127+ foreach ($ block as $ blockName => $ fields ) {
128+ $ fields = $ fields ;
129+ array_shift ($ fields );
130+ if (is_array ($ fields )) {
131+ $ record [$ key ]->addFromArray ($ fields , $ group , null , $ blockName );
132+ }
133+ }
134+ }
135+ }
136+
116137 if (isset ($ contentType ['fields ' ][$ key ]) && $ contentType ['fields ' ][$ key ]['type ' ] === 'repeater ' && $ value !== null ) {
117138 /**
118139 * Hackish fix until #5533 gets fixed, after that the
You can’t perform that action at this time.
0 commit comments