0

I need to render the image's attributes (src, alt, width and height) from a ds1-col.html.twig (Display Suite) in a node.

I can render strings using {{ ds_content.node_title }}, however... I don't know how to do with the field_cover_image referenced from the media module.

  1. Using dump {{ dump(ds_content) }} throws this:

{{ dump(ds_content) }}

  1. The field_cover_image is a reference to a media entity image.
    URL: /admin/structure/types/manage/my_node/fields.

media config field_cover_image media

  1. The reference image.
    URL: /admin/structure/media/manage/image/fields. Media image
3
  • Are you trying to render the image with these attributes, or literally print these attributes to the node? Commented Aug 11, 2024 at 13:49
  • Print these attributes in the twig Commented Aug 12, 2024 at 14:03
  • You can retrieve the Image from the media field with field_cover_image.entity, and the values you want should be on that entity somewhere. Commented Aug 13, 2024 at 0:38

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.