Problem/Motivation
Front-end developers and themers who want full control over the markup use custom image markup in a parent (e.g. node) template:
<img src="{{ content.field_image.url }}" class="image-thumb" alt="content.field_image.alt"/>
Only the file field has a URL only formatter, but Image module and Link module don't. Workarounds like below violate caching because no caching metadata bubbles up:
{{ file_url(content['#object'].field_image.0.entity.uri.value) }}
Proposed resolution
Provide a field formatter that only returns the URL of an image. Other field data should also be accessible from within the parent template.
Remaining tasks
tbd
User interface changes
tbd
Comments
Comment #2
sutharsan commentedComment #3
evanmwillhite commentedThis would be a really nice addition as it is a very common use-case in component-based theming (see the markup in all the examples here). I didn't even realize the caching issue, which makes this even more relevant.
Comment #4
amateescu commentedWe're trying to do exactly this in #2517030: Add a URL formatter for the image field.