- Status changed to Closed: works as designed
7 months ago 4:13pm 22 May 2024 - 🇪🇨Ecuador jwilson3
It is not common to have third and fourth level entity references all immediately loaded for rendering in Twig. How would we know which view mode to render?
This functionality can best be achieved using the
drupal_entity
function from the Twig Tweak module, which is one of the primary reasons that module exists.{% set media_id = node.field_category.entity.field_svg.entity.id %} {% set media_view_mode = 'default' %} {{ drupal_entity('media', media_id, media_view_mode )}}
Closing this as works as designed.