1

I installed the "Twig Tweak" module for Drupal 8

I created an "EVA" display. The view id is "contenu_relation_groupe" and the display id is "entity_view_1".

I added the following in the twig template for my nodes:

{{ drupal_view('contenu_relation_groupe', 'entity_view_1') }}

But nothing is displayed. Any idea why?

I've never managed to embed an "EVA" view in a twig template.

4
  • EVAs are designed to be placed via the Manage Display screen on your entity. Maybe try that or switch your view to be a block and then try the twig tweak.
    – sonfd
    Apr 24 '18 at 13:35
  • @sonfd OK, thanks but i need to display it in twig
    – user84727
    Apr 24 '18 at 15:21
  • If you add it to your display via Manage Display it will be available in your twig template, just like any other field, that's the whole point of the EVA display type.
    – sonfd
    Apr 24 '18 at 15:25
  • @sonfd I is already enabled in the display, but the twig code returns nothing
    – user84727
    Apr 24 '18 at 15:46
0

EVAs get added as a field with name like VIEW_ID_DISPLAY_ID. They should appear in the content variable like any other field.

If you've added your EVA to the node's display you should be able to render your EVA, with the configuration from the Manage Display screen, like

{{ content.contenu_relation_groupe_entity_view_1 }}.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy