I have a field called Media (machine name: field_media) inside of a content type. This field Media takes the media types of Remote video, Image, and Documents. I am currently trying to render this media inside my twig template as a link to whatever media type it is. For example, if it's a remote youtube video, the link would take you to the video or if it's a pdf document, the link would take you to the internal page to display that document. Examples:
So inside my field twig template, grab the above values and for each item, place it inside an href
attribute like so:
<div{{ item.attributes.addClass('field__item') }}><a href={{ url_of_internal_document_image_or_remote_video }}>{{ item.content }}</a></div>
Inside the href
value I've tried values such as node.field_media.entity.field_media_oembed_video.value
(for remote video) but that didn't work.
My twig template is displaying like this: Which looks how I want but I can't get the link to take me to the remote vid or internal pdf.
Side note: In the Manage Display menu of my content type, I have this configuration for the field.
node.field_media.entity.field_media_oembed_video.0
?