I have installed devel kint module on my drupal 8. Everything is fine with the module.

But my problem is how should I interpret the output of kint correctly. Especially when I want to render field within file entity.

Here is the scenario:

  1. I have a form created with YAMLForm in my front. In that form user can upload image.
  2. User submit the form.
  3. When I debug data with kint, I can see the url of the image, but I am unnable to display it thru .

Please find below a screenshot of the kint output

kint output

I have tryied with the following but no chance :

{{ file_url(data.picture['#value']['#file'].entity['#values'].uri['x-default']) }}
{{ file_url(data.picture.0['#item'].entity.uri.value) }}
{{ file_url(data.picture.entity.fileuri) }}

I've Googled for hours but couldn't find any clues.

Thanks in advance for your help.

  • see Get Image URL in Twig – No Sssweat Oct 27 '16 at 13:18
  • Alternatively, you could use the image url formatter and when you {{ content.field_name[0] }} it will print the url instead of the actual picture as long as you set the field formatter to url formatter – No Sssweat Oct 27 '16 at 13:20

You can't load protected values. So kint is not much help here.

But you can try this, load directly the uri value:

{{ file_url(data.picture['#value']['#file'].uri.value) }}
  • Thanks for your answer. I tryied it out and it works like a charm – Rado Oct 27 '16 at 15:36

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