I have a content type (Type A) that has an Entity Reference field to another content type (Type B).

Type B has 3 fields and 2 display modes. Display A shows two of the fields, Display B shows the other field.

In the display settings for Type A, the display mode for the Type B entity is set to Display 1.

On the template for Type A, I can use {{ content.field_type_b }} and the two fields are shown.

Now, I want to be able to output the field again, but as Display 2, in a different part of the template.

In a pseudo twig code way, I'd imagine something like {{ content.field_type_b|display_mode('display_2') }}

I have heard suggestions for Display Suite, but I tried this and it seems whilst you can clone a field, there is no option to render it as an entity with a display mode.

I also found Twig Tweak, which I think might work, however, the documentation is beyond terrible and I cannot see how I'd actually use it (the cheat sheet lacks all manner of help).

If this is not possible in Twig, could this be achieved in a hook? Bearing in mind, the field I want to render in Display 2, is a nicely rendered map, so I don't want to simply get the field value, it has to be using the display mode.

  • There a several approaches to this, see drupal.stackexchange.com/questions/225381/…, but since then EVA was released and now I would attach an EVA view display to the node for an UI only solution.
    – 4uk4
    Commented Nov 17, 2017 at 11:02
  • How would I use EVA (in D8) to output the field twice with different display modes? there is no D8 documentation for that module. Commented Nov 17, 2017 at 11:39

1 Answer 1


How to display a reference field twice with the help of EVA:

  1. Install EVA.

  2. Add a new View.

  3. Add a display "EVA".

  4. Add the Entity Reference field to FIELDS and configure the Formatter to "Rendered entity" and set the view mode Display 2.

  5. The EVA display includes the section ENTITY CONTENT SETTINGS, choose the entity type Content and bundle Type A.

  6. In the ADVANCED section add a contextual filter for Content: ID.

  7. Save the View.

  8. Now the new field is visible in the field UI of the content type Type A and you can drag'n'drop it to the final position.

  • What would the twig variable be? I am defining my template using {{ content.field_name }} to put fields where I want. What is the machine name for the new EVA view? Commented Nov 17, 2017 at 13:50
  • Try {{ dump(content|keys) }}, should be something like this {{ content.VIEW_NAME_entity_view_1 }}
    – 4uk4
    Commented Nov 17, 2017 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.