Can't link field to non-required prop if it's empty on the entity.

Created on 25 September 2025, 15 days ago

Overview

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
does not complete.

This appears to be because when the entity field is empty, it is removed from the $inputs array returned by
\Drupal\canvas\Plugin\Canvas\ComponentSource\GeneratedFieldExplicitInputUxComponentSourceBase::getClientSideInfo

Which ultimately results in buildComponentInstanceForm not being able to get the $source value that would identify the prop as dynamic, because when this runs:

$source = $this->uncollapse($inputValues[$sdc_prop_name] ?? NULL, $sdc_prop_name);

There is no $inputValues[$sdc_prop_name] because it was not included by the array returned by getClientSideInfo

See here for $evaluated = $source->evaluate($host_entity, $is_required_prop); some xdebug demonstrating the null evaluated when the specified host entity field is empty.

Proposed resolution

Steps to reproduce

  • When building a template, the entity should have an empty non-required field (or an empty revision log message will work too)
  • Try to link an optional prop to the empty entity field or empty revision log message
  • The link process will not complete
  • A breakpoint just after $evaluated = $source->evaluate($host_entity, $is_required_prop); will show you the place where the array-skipping NULL occurs. I'm sure the internals of $source->evaluate will reveal more.
🐛 Bug report
Status

Active

Version

1.0

Component

… to be triaged

Created by

🇺🇸United States bnjmnm Ann Arbor, MI

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024