Linked Questions

0
votes
2answers
3k views

get images URL in a twig template [duplicate]

I have two content types, the first is Homepage and the second is SLider. The Slider content type has multiple fields like title, ink, and image. In the homepage content type, I have an entity ...
0
votes
1answer
470 views

How to interpret kint output [duplicate]

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 ...
2
votes
0answers
50 views

How do I get the path to a directory of an image file and how do I get the name of the image? [duplicate]

I am new to Drupal and new to twig. I am currently using Drupal 8.1.1. I would like to obtain two things, the directory path of the image and the image name. I can get the path to the image using twig:...
46
votes
16answers
90k views

Getting the image URL from a field_image on a node

So I have this Node: object(Drupal\node\Entity\Node)[1862] protected 'values' => array (size=17) 'vid' => array (size=1) 'x-default' => string '7' (length=1) ...
2
votes
2answers
6k views

How do I get an image path from field preprocess function

After 3 hours of searching the web for this I gave up... I have added a "banner image" field to the basic page. I want to use the image as a background. I wanted to capture the image path in a ...
8
votes
2answers
6k views

Get an image with style url from an URI in twig

So thanks to 4k4 I finally managed to get my original image URI in a field template via item.content['#item'].entity.uri.value and with {{ file_url(item.content['#item'].entity.uri.value) }} I ...
0
votes
1answer
2k views

How to get path of image from file id

I have this output from my twig template dump: /var/www/html/vendor/twig/twig/lib/Twig/Extension/Debug.php:56: array (size=7) 'id' => string 'views_block:about-block_1' (length=25) 'label' =&...
2
votes
1answer
820 views

Access field object (not render array) in field templates

In most entity templates like node.html.twig or paragraph.html.twig I do get two major variables, the render array variable {{ content }}, but also the entity object variable like {{ node }} or {{ ...
1
vote
1answer
142 views

How to find Image URI in Kint via .entity in the node tree

I am working on Drupal 8 finally and using the replacement for Krumo which is Kint. It packs a lot more information in than Krumo did, and came with a bit of confusion. While trying to get the image ...
0
votes
0answers
118 views

How can I preprocess a node field value to make it accessible in the template level beneath field level (video template inside file field)

I am using the Video.js (HTML5 Video Player) module and I would like to add an image for the poster by loading the URL of another image field in the same node (without modifying the module itself). ...