I'm using Drupal 8.5. I have a content type with the in-core media module. I'm making a view for content syndication, and I need one of the columns to be the FDQN URI to the media resource-- i.e, not the rendered entity itself (which comes through as an img tag), but https://example.com/sites/default/files/media_image.jpg.

I've added the media field to my view, but I didn't find any Formatter, View Mode, or Rewrite Pattern that gives me the absolute URL to the resource. I can get the path to the media (e.g. https://example.com/media/1899), the entity_id (e.g. 1899), but no path to the file.

How can I render the path to the media image in my view?


The media field is an entity reference type field. You will need to add a relationship to the media entity. This should add the URI field in media entity to the view selections. You should then be able to select this (with the right reference relationship) and use the standard URL formatters.

| improve this answer | |
  • Thanks for this @CG Monroe. It makes perfect sense. For anyone else tagging along, once you have created a relationship to the media entity for the type of node that you are referring to in your view, you can then select a media field with the relationship and use the URL formatter. – Andrew Wasson Aug 7 at 0:55

Your Answer

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

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