@@ -209,19 +209,34 @@ 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
224+ control are deprecated and were never supported in accordance to the
225+ JSON Forms documentation. Use the options "itemLayout" and "elements"
226+ instead.
227+ EOD ,
228+ E_USER_DEPRECATED
229+ );
230+ // phpcs:enable
218231 }
219232
220- $ arrayUiSchema ->type ??= 'TableRow ' ;
233+ $ arrayUiSchema = new \stdClass ();
234+ $ arrayUiSchema ->type = $ definition ->getOptionsValue ('itemLayout ' ) ?? $ detail ->type ?? 'TableRow ' ;
221235
222236 $ items = $ definition ->getItems ();
223237 Assertion::isInstanceOf ($ items , \stdClass::class);
224- $ arrayUiSchema ->elements ??= $ this ->createElementSchemas ($ items );
238+ $ arrayUiSchema ->elements = $ definition ->getOptionsValue ('elements ' ) ?? $ detail ->elements
239+ ?? $ this ->createElementSchemas ($ items );
225240
226241 return new ArrayLayoutDefinition (
227242 $ arrayUiSchema , $ items , $ definition ->isUiReadonly (), $ definition ->getRootDefinition ()
0 commit comments