Problem/Motivation

Webform provides several entity reference selection elements like:

  • webform_entity_checkboxes
  • webform_entity_radios

for example.

For our use-case, we'd like to show the rendered entities instead of their label in a certain view mode ("card").

I neither could find a setting for that nor a contrib module solving that.

Modules like

allow rendering a selected entity in a webform, but not as checkboxes / radios values.

The rendering should happen in the form, not in the submissions display.

Am I missing something or isn't this feature existing yet?

(Of course, this is not a request for the maintainer to implement this, but to ask if this feature would be accepted by the maintainer and to ensure it's not already solved somewhere and I didn't find it.)

Thank you!

Steps to reproduce

Add an entity reference webform element to the webform like Entity radios or Entity checkboxes and try to render the referenced entity instead of the label as options.

Proposed resolution

  1. Provide a setting to select if the label or the rendered entity (in a selected view mode) should be used as options
  2. Render the entity as options in the selected view mode, if that option is chosen

Remaining tasks

  1. Ensure the feature doesn't already exist
  2. Get green light from maintainer
  3. Implement
  4. Test
  5. Release

User interface changes

API changes

Data model changes

Issue fork webform-3469200

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Anybody created an issue. See original summary.

anybody’s picture

Component: Code » Documentation

Sorry, I found it!

Reference method: Views filter by an entity reference view

does the trick!
No idea why I didn't see that for hours...

So the question is: Should I prepare a MR to add some lines of description to the form to let the users know about this, when using the regular reference method?

Something like:
For more advanced use-cases like rendered entities or more complex entity filtering or sorting, you may want to use the "Views filter by an entity reference view reference method."

liam morland’s picture

Sure, better documentation is welcome.

i'mbatman made their first commit to this issue’s fork.

jrockowitz made their first commit to this issue’s fork.

jrockowitz’s picture

Status: Active » Reviewed & tested by the community

Marking RTBC because this is a simple change that can be committed AS-IS.

anybody’s picture

Thanks!!

  • liam morland committed 102f351c on 6.3.x
    Issue #3469200: Allow to use rendered entities (in selected view mode)...
jrockowitz’s picture

Status: Reviewed & tested by the community » Fixed

  • liam morland committed 102f351c on 6.x
    Issue #3469200: Allow to use rendered entities (in selected view mode)...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.