Entity embed currently hard codes disabling entity_reference_entity_view plugin. This is because the 'view_mode' EntityEmbedDisplay plugin is intended to replace it wholesale (Implemented in #2736741: Treat each view mode in "Rendered entity" formatter as a standalone formatter). However in some cases it can be useful for the plugin to be enabled, for entities that do not implement view modes, namely configuration entity types. And in my use case, specifically the Webform configuration entity type. Webform implements the standard view_builder handler system, and can be displayed with regular entity_reference_entity_view formatters.
Other related issues, especially for cores' contact.module have closed similar issues as works-as-designed. I can speak from experience that embedding things like Webform via entity_reference_entity_view formatter for an entity_reference field have worked with success. In my use case it was for a Paragraph, however I'd like to get away from Paragraphs and use Entity Embed.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 3046480-9.patch | 6.11 KB | wim leers |
| #9 | interdiff.txt | 1.86 KB | wim leers |
| #7 | 3046480-config-embeds-7.patch | 5.63 KB | dpi |
| #7 | interdiff-3046480-config-embeds-5-7.txt | 1.51 KB | dpi |
| #5 | 3046480-config-embeds-5.patch | 5.63 KB | dpi |
Comments
Comment #2
dpiIm proposing removing the
no_uihardcoded workaround for this plugin type, and replacing it with an implementation of\Drupal\entity_embed\EntityEmbedDisplay\EntityEmbedDisplayInterface::access, wherein we decide at runtime whether the plugin is applicable for the entity type in context.The result of this patch is: Entity embed buttons for content entity types: no change, Entity embed for configuration entity types: "Rendered entity" plugin now visible in button "Allowed Entity Embed Display plugins" checkbox selection on button config form, and "Display as" dropdown when inserting/editing configuration embeds
Behaviour of
rendered_entity_modeconfig is retained.Comment #3
dpiAdded relevant issues.
Relevant comment #2796269-3: Contact_form cannot be embedded without rendered entity formatter
Comment #4
dpiFWIW I'm in disagreement with #2748581-20: Embedding core Contact forms. The project already exposes configuration entities when adding button entities, why not allow this.
Comment #5
dpiRebased on HEAD.
Comment #7
dpiCS + a different context is available depending on form/render caller
Comment #8
wim leersI wrote that comment :) You'll be happy to hear that #3055050: Loosen EntityEmbedFilter's greedy exception capture: catch only relevant exceptions landed earlier today and fixed that same problem.
This is a very good point.
Manually tested, works as expected and advertised 👍
Comment #9
wim leersFix coding standards issues and a typo.
Comment #11
wim leers🚢