Problem/Motivation

Hi, I just found this article: https://dev.to/jcandan/i-built-a-new-drupal-canvas-sdc-module-with-ai-in...

and the described module: https://www.drupal.org/project/sdc_entity_mapping

Maybe the module should also get listed as possible alternative on the module page?
What do you think about the concept?

I think one downside is that you have to maintain one further mapping somewhere, instead just rendering an entity (in a certain view mode) which might be the future here?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

anybody created an issue. See original summary.

anybody’s picture

Issue summary: View changes
anybody’s picture

Status: Active » Needs work

Should be listed in this area on the module page:

Similar projects

There are currently no dedicated modules providing entity reference integration for Canvas component props.
For non-Canvas use cases such as Layout Builder or Paragraphs, use Drupal core Entity Reference fields.

Are there other similar projects? Or maybe it would make sense to link related core issues?

zeeshan_khan’s picture

Status: Needs work » Needs review

Good catch, thank you. I have updated the "Similar projects" section on the project page to list sdc_entity_mapping with a brief description of how the two approaches differ.

I am not aware of other dedicated modules covering this use case at the moment. If you know of related core issues worth linking, feel free to share them here and I will add those as well.

Thanks

anybody’s picture

@thomas.frobieter maybe you'd like to add your findings from contrib and related core issues?

anybody’s picture

Title: List sdc_entity_mapping as alternative? » List sdc_entity_mapping and other modules and Canvas plans as alternative?
thomas.frobieter’s picture

This just landed in canvas: https://git.drupalcode.org/project/canvas/-/commit/29e44233fe353fda804eba99ae0aa4fdf55f0050

However, it only applies to code components at the moment, which is a deal-breaker if you need a non-JS fallback.

But maybe it's worth taking a look at the code; perhaps there's still room for some standardization.

zeeshan_khan’s picture

Thanks @thomas.frobieter! That's useful context.

The Canvas commit you referenced is worth noting — it addresses entity mapping specifically for code components. As you pointed out, the non-JS fallback limitation is significant: site builders using block/UI components with a standard Canvas form widget aren't served by that approach, which is precisely the gap this module fills.

I'll update the project page to reference that Canvas work alongside sdc_entity_mapping, with a clear note on what each covers and where this module fits in.

  • zeeshan_khan committed 10008f9e on 1.0.x
    Issue #3589005 by zeeshan_khan: Expand Related issues section with...

  • zeeshan_khan committed 2ec89b62 on 1.0.x
    Revert "Issue #3589005 by zeeshan_khan: Expand Related issues section...

  • zeeshan_khan committed 3e76c3be on 1.0.x
    Issue #3589005 by zeeshan_khan: Expand Related issues section with...
zeeshan_khan’s picture

I've looked through that Canvas commit. It adds a content-entity-reference well-known prop shape for code components (JavaScript/React) — entity type and bundle are declared via dataDependencies.entityFields in the JS component config and resolved at render time by JsComponent::getExplicitInput(). There is no autocomplete widget and no Twig/non-JS path, so it does not address the use case this module covers: Twig/block components with a proper Canvas form widget for content editors.

The approaches are complementary rather than overlapping — code component authors can use Canvas core's built-in mechanism; Twig component authors need this module.

Updated the README "Related issues" section to reference the Canvas commit and sdc_entity_mapping with a clear note on what each covers and where this module fits in.

thomas.frobieter’s picture

Okay, thanks for looking into it. I'll start creating SDCs with Canvas Entity Reference next week and will test them thoroughly. I'm really looking forward to it!👌

zeeshan_khan’s picture

Thank you much appreciated!