@@ -209,19 +209,32 @@ 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+ Assertion::nullOrIsInstanceOf ($ detail , \stdClass::class);
220+ if (isset ($ detail ->type ) || isset ($ detail ->elements )) {
221+ // phpcs:disable Drupal.Semantics.FunctionTriggerError.TriggerErrorTextLayoutRelaxed
222+ @trigger_error (<<<EOD
223+ The properties "type" and "elements" in option "detail" of an array control are
224+ deprecated and were never supported in accordance to the JSON Forms
225+ documentation. Use the options "itemLayout" and "elements" instead.
226+ EOD ,
227+ E_USER_DEPRECATED );
228+ // phpcs:enable
218229 }
219230
220- $ arrayUiSchema ->type ??= 'TableRow ' ;
231+ $ arrayUiSchema = new \stdClass ();
232+ $ arrayUiSchema ->type = $ definition ->getOptionsValue ('itemLayout ' ) ?? $ detail ->type ?? 'TableRow ' ;
221233
222234 $ items = $ definition ->getItems ();
223235 Assertion::isInstanceOf ($ items , \stdClass::class);
224- $ arrayUiSchema ->elements ??= $ this ->createElementSchemas ($ items );
236+ $ arrayUiSchema ->elements = $ definition ->getOptionsValue ('elements ' ) ?? $ detail ->elements
237+ ?? $ this ->createElementSchemas ($ items );
225238
226239 return new ArrayLayoutDefinition (
227240 $ arrayUiSchema , $ items , $ definition ->isUiReadonly (), $ definition ->getRootDefinition ()
0 commit comments