Blog
How to access custom block content field in Twig (Drupal 10)
I started using custom blocks for reusable content on a website. It turns out twig works a bit different on block content than on paragraphs.
Blog
How to loop over field items in twig file in Drupal
If you want to use a looping functionality in x.html.twig you can use the following:
Blog
How to add direct share links to your Drupal page in page.html.twig
The following snippets can be used to get direct share links to Facebook, Twitter and LinkedIn in your page.html.twig
Blog
Get a link field url and value in Twig for both internal and external links
Drupal's link field is quite generic. You can both add internal paths as external links. Here is how get the correct values in twig.
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 get entity reference value and link to it in a paragraph
I had this use case where I had to show a label and link to another content type from within my paragraph. Because the theming was specific, I had to get the label and link in twig
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
Pagination
- Previous page
- Page 2