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>…<br> throw new \LogicException('Support for "array" props is not yet implemented.');<br>…</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 — 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> type: object<br> required:<br> - data<br> properties:<br> data:<br> type: array<br> title: Sparkline data<br> maxItems: 100<br> items:<br> type: integer<br> minimum: -100<br> maximum: 100<br> examples:<br> - [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> type: object<br> required:<br> - images<br> properties:<br> caption:<br> type: string<br> title: Caption<br> description: The image gallery caption<br> images:<br> title: 'Images for gallery'<br> type: array<br> items:<br> $ref: json-schema-definitions://experience_builder.module/image<br> # @todo `type: object` should not be necessary, it's because \Drupal\sdc\Component\ComponentValidator::getClassProps() does not yet support $ref<br> type: object<br> examples:<br> - - src: gracie.jpg<br> alt: 'A good dog'<br> width: 601<br> height: 402<br> - src: gracie.jpg<br> alt: 'Still a good dog'<br> width: 601<br> height: 402<br> - src: gracie.jpg<br> alt: 'The BEST dog!'<br> width: 601<br> height: 402</pre><p>… 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