@@ -209,19 +209,29 @@ private function buildTableHeader(LayoutDefinition $arrayLayoutDefinition): arra
209209 }
210210
211211 private function createLayoutDefinition (ArrayControlDefinition $ definition ): ArrayLayoutDefinition {
212- // Note: We actually do not use "detail" as it is described in JSON Forms:
212+ // Note: We used to use "detail" as specification of the "normal" display,
213+ // not as it is described in JSON Forms:
213214 // https://jsonforms.io/docs/uischema/controls#the-detail-option
214- // Should we use another option name instead?
215- $ arrayUiSchema = $ definition ->getOptionsValue ('detail ' );
216- if (!$ arrayUiSchema instanceof \stdClass) {
217- $ arrayUiSchema = new \stdClass ();
215+ // Now we use the option "elements" to specify individual controls for the
216+ // properties of an item and the option "itemLayout" to specify the layout
217+ // to display the elements.
218+ $ detail = $ definition ->getOptionsValue ('detail ' );
219+ if (isset ($ detail ->type ) || isset ($ detail ->elements )) {
220+ trigger_error (<<<EOD
221+ The properties "type" and "elements" in option "detail" of an array control are
222+ deprecated and were never supported in accordance to the JSON Forms
223+ documentation. Use the options "itemLayout" and "elements" instead.
224+ EOD ,
225+ E_USER_DEPRECATED );
218226 }
219227
220- $ arrayUiSchema ->type ??= 'TableRow ' ;
228+ $ arrayUiSchema = new \stdClass ();
229+ $ arrayUiSchema ->type = $ definition ->getOptionsValue ('itemLayout ' ) ?? $ detail ->type ?? 'TableRow ' ;
221230
222231 $ items = $ definition ->getItems ();
223232 Assertion::isInstanceOf ($ items , \stdClass::class);
224- $ arrayUiSchema ->elements ??= $ this ->createElementSchemas ($ items );
233+ $ arrayUiSchema ->elements = $ definition ->getOptionsValue ('elements ' ) ?? $ detail ->elements
234+ ?? $ this ->createElementSchemas ($ items );
225235
226236 return new ArrayLayoutDefinition (
227237 $ arrayUiSchema , $ items , $ definition ->isUiReadonly (), $ definition ->getRootDefinition ()
0 commit comments