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?
Comments
Comment #2
anybodyComment #3
anybodyShould be listed in this area on the module page:
Are there other similar projects? Or maybe it would make sense to link related core issues?
Comment #4
zeeshan_khan commentedGood 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
Comment #5
anybody@thomas.frobieter maybe you'd like to add your findings from contrib and related core issues?
Comment #6
anybodyComment #7
thomas.frobieterThis 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.
Comment #8
zeeshan_khan commentedThanks @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.
Comment #12
zeeshan_khan commentedI'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.
Comment #13
thomas.frobieterOkay, 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!👌
Comment #14
zeeshan_khan commentedThank you much appreciated!