Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By thomas.leperou on
I feel suddenly dumb... I've not gone through with this today: get the URI of an image field of a custom block.
The documentation and the stackoverflow issues talk about content.field_id.entity.uri to get the URI of an image field.
Sounds stupid, right? But how do you do to get the URI for an image field ? Because in my case, D 8.2, there is not any URI (I use kint, plus Devel). I'd like to use file_url() to render the field as a background.
Regards.
Comments
Here is one way to do it