Drupal

Blog

How to know if a user is logged in in page.html.twig in Drupal

This is quite an easy one. You get the following variables available in page.html.twig:

Blog

How to do a for loop in Twig PHP

This is the way to do a "for" loop. We are going to loop over an array of Node objects of type 'sector'

Blog

How to loop over config file values in Drupal

I had this use case in my theme, where I wanted to expose a bunch of settings to my page.html.twig. Typical things would be social media links. Here is how I looped over config file values, preventing me to write a lot of lines:

Blog

How to set the theme svg logo in a Drupal theme

In Drupal 8, the default logo needs to be a SVG file. Add this to your theme like this: themes/custom/mytheme/logo.svg.

Blog

How to create a custom Drupal theme with Bootstrap 5 dependency in 4 steps

Tutorial on how to create a Drupal 9 & 10 Bootstrap 5 integration with npm

Blog

Useful developer settings for Drupal: how to

So if you are building in Drupal > 8, you can have settings in the database (coming from configuration yaml files). BUT, you can also hardcode these in your settings.php file. These will always override the settings in the database. 

Subscribe to Drupal