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

taggartj’s picture

$node->getFieldDefinition('field_name_of_your_image_field')->getFieldStorageDefinition();

there has settings and you can see the uri_schema