Skip to content

Tag: twig

How do I display 3 recent posts in footer with Timber?

So, I am beating my head over this for 2 days now. How do I display 3 recent posts in footer using Timber and Twig? I am using a starter theme from Timber. What I did inside my footer.php file: And inside my footer.twig I tried displaying them: Now the problem is it displays nothing. If I replace featured wit…

Foreach image uploaded in a Node Content : get the url

I’m beginning with Drupal 8 and I want to get the url of the photos in the content I create to display them. The context is: a photograph upload pictures for a customer. This customer can see it on a page. To get this data in common I created a content for my shooting with an id. What i did

How to inject global variables into all templates?

In my twig template there are some variables that are required on each page like userName, userId or userImage. What is the best way to inject them into the template? I already read the article How to Inject Variables into all Templates but how could I write a variable (e.g. current user) into the config/pack…