Can't link (pick a DynamicPropSource) to populate an optional explicit input if that DynamicPropSource evaluates to `NULL` (typically: field is empty)
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3548761. -->
Reported by: [bnjmnm](https://www.drupal.org/user/2369194)
Related to !169
>>>
<h3 id="overview">Overview</h3>
<p>If you have a non-required prop and try to link it to an entity field that is empty on the entity being previewed, the linking<br>
does not complete.</p>
<p>This appears to be because when the entity field is empty, it is removed from the array returned by<br>
<code>\Drupal\canvas\Plugin\Canvas\ComponentSource\GeneratedFieldExplicitInputUxComponentSourceBase::getClientSideInfo</code><br>
which become the $inputValues that inform the build of the props form</p>
<p>This ultimately results in <code>buildComponentInstanceForm</code> not being able to get the <code>$source</code> value that would identify the prop as dynamic, because when this runs:</p>
<div class="codeblock">
<pre><span style="color: #000000"><span style="color: #0000BB"><?php<br>$source </span><span style="color: #007700">= </span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">uncollapse</span><span style="color: #007700">(</span><span style="color: #0000BB">$inputValues</span><span style="color: #007700">[</span><span style="color: #0000BB">$sdc_prop_name</span><span style="color: #007700">] ?? </span><span style="color: #0000BB">NULL</span><span style="color: #007700">, </span><span style="color: #0000BB">$sdc_prop_name</span><span style="color: #007700">);<br></span><span style="color: #0000BB">?></span></span></pre></div>
<p>There is no <code>$inputValues[$sdc_prop_name] </code> because it was not included by the array returned by <code>getClientSideInfo</code></p>
<p>See here for <code> $evaluated = $source->evaluate($host_entity, $is_required_prop);</code> some xdebug demonstrating the null evaluated when the specified host entity field is empty.<br>
<img width="400" src="https://www.drupal.org/files/issues/2025-09-25/Screenshot%202025-09-25%20at%2012.52.57%E2%80%AFPM.png" alt="revision log empty"></p>
<h3 id="proposed-resolution">Proposed resolution</h3>
<h3 id="ui-changes">Steps to reproduce</h3>
<ul>
<li>When building a template, the entity should have an empty non-required field (or an empty revision log message will work too)</li>
<li>Try to link an optional prop to the empty entity field or empty revision log message</li>
<li>The link process will not complete</li>
<li>A breakpoint just after <code>$evaluated = $source->evaluate($host_entity, $is_required_prop);</code> will show you the place where the array-skipping NULL occurs. I'm sure the internals of <code> $source->evaluate</code> will reveal more.</li>
</ul>
> Related issue: [Issue #3485878](https://www.drupal.org/node/3485878)
issue