Support `{type: array, …}` prop shapes
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3467870. --> Reported by: [wim leers](https://www.drupal.org/user/99777) Related to !331 >>> <h3 id="overview">Overview</h3> <p>Quoting <code>\Drupal\experience_builder\SdcPropToFieldTypePropMatcher::iterateJsonSchema():</code></p> <pre>&hellip;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new \LogicException('Support for "array" props is not yet implemented.');<br>&hellip;</pre><h3 id="proposed-resolution">Proposed resolution</h3> <p>Support it:</p> <ol> <li>at the prop expression level</li> <li>must be able to compute a <code>StaticPropSource</code></li> <li>must be able to match against field instances in a <code>DynamicPropSource</code>, to avoid accumulating a gap/technical debt for <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3455629" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3455629</a></span></li> <li>must allow existing <code>all-props</code> SDC to continue to work, and its test coverage to still pass</li> <li>must come with solid test coverage, proving <code>type: array</code> works with both scalars (<code>sparkline</code> SDC) and <code>type: object</code>s (<code>image-gallery</code> SDC)</li> </ol> <p><u>Out-of-scope:</u> fully working widgets for <code>StaticPropSource</code>s &mdash; see <a href="https://www.drupal.org#comment-16096192">#28</a> for how it for example only partially works for <code>MediaLibraryWidget</code> for the new <code>image-gallery</code> test SDC. <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/experience_builder/issues/3517868" title="Status: Closed (fixed)">#3517868: Add e2e tests for multi-value textfield widget in page data form</a></span> might help. But <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-1"><a href="https://www.drupal.org/project/canvas/issues/3515563" title="Status: Active">#3515563: [META] Expand support to *all* SDC prop shapes, and *all* core field widgets</a></span> is the one whose scope it is to get all these working.</p> <h3 id="ui-changes">User interface changes</h3> <dl> <dt><code>sparkline</code> test SDC</dt> <dd> <img src="https://www.drupal.org/files/issues/2025-05-05/preview%20array%20of%20integers.png" alt=""> <p>powered by:</p> <pre>props:<br>&nbsp; type: object<br>&nbsp; required:<br>&nbsp;&nbsp;&nbsp; - data<br>&nbsp; properties:<br>&nbsp;&nbsp;&nbsp; data:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type: array<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; title: Sparkline data<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxItems: 100<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; items:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type: integer<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; minimum: -100<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maximum: 100<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; examples:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - [0, 10, 20, 30, -40, -50, 5, 7, 9]</pre></dd> <dt><code>image-gallery</code> test SDC</dt> <dd> <img src="https://www.drupal.org/files/issues/2025-05-05/preview%20array%20of%20images.png" alt=""> <p>powered by</p> <pre>props:<br>&nbsp; type: object<br>&nbsp; required:<br>&nbsp;&nbsp;&nbsp; - images<br>&nbsp; properties:<br>&nbsp;&nbsp;&nbsp; caption:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type: string<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; title: Caption<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; description: The image gallery caption<br>&nbsp;&nbsp;&nbsp; images:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; title: 'Images for gallery'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type: array<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; items:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ref: json-schema-definitions://experience_builder.module/image<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # @todo `type: object` should not be necessary, it's because \Drupal\sdc\Component\ComponentValidator::getClassProps() does not yet support $ref<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type: object<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; examples:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - - src: gracie.jpg<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alt: 'A good dog'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width: 601<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height: 402<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - src: gracie.jpg<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alt: 'Still a good dog'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width: 601<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height: 402<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - src: gracie.jpg<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alt: 'The BEST dog!'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width: 601<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height: 402</pre><p>&hellip; with a partially working widget too, see video in <a href="https://www.drupal.org#comment-16096192">#28</a>.<br> </p></dd> </dl> > Related issue: [Issue #3456008](https://www.drupal.org/node/3456008) > Related issue: [Issue #3454125](https://www.drupal.org/node/3454125) > Related issue: [Issue #3461499](https://www.drupal.org/node/3461499) > Related issue: [Issue #3440578](https://www.drupal.org/node/3440578) > Related issue: [Issue #3463842](https://www.drupal.org/node/3463842) > Related issue: [Issue #3467954](https://www.drupal.org/node/3467954) > Related issue: [Issue #3522718](https://www.drupal.org/node/3522718) > Related issue: [Issue #3546869](https://www.drupal.org/node/3546869) > Related issue: [Issue #3520449](https://www.drupal.org/node/3520449)
issue