Drupal Howtos

A how-to is a short description of how to accomplish a specific task. This is a compilation of Drupal related howto's which I provided to friends or which I applied myself. Targeting the Drupal beginner they provide simple and detailed step-by-step descriptions with pictures.

How to add a custom html.html.twig to your Drupal 8 theme

The html twig file (html.html.twig) in Drupal 8, what was previously the html.tpl.php in Drupal 7.

If there is no html.html.twig in your theme folder /themes/custom/THEME-NAME/templates, just copy the default html.html.twig file from /site/core/modules/system/templates to this folder.

Thereafter you can edit the file to make the desired modifications. Thus you can for example overwrite the {{ html_attributes }}, what can be an efficient mean to change the language tag (html lang="en") without installing language modules.

Twig and Drupal

Drupal 7: How to override the page.tpl for specific content types?

A common override that is not included in the default list is the page.tpl.php override based on the content type being displayed. There is a node.tpl.php override based on the same condition which leads to confusion as to where the page override exists. On top of that, themes like Zen add this type of override to the Template Suggestions, which leads those using Zen to believe that this is part of the default list. Check the theme documentation to see if this override has been added to the Template Suggestions by the theme. If it hasn’t, you need to add it manually.

Drupal PHP

How to choose, download and install additional themes?

Themes allow you to change the look and feel of your website. This howto will give you step-by-step instructions how to choose, download and install a theme.

List of Drupal themes

"From address" doesn't work in Forward Module. How to solve the issue?

If the "From address" is left blank the site email address is used instead of the address entered by the user. This howto shows you how to solve the issue quickly.

How to change the language attribute href (html lang="xx") without extra installations

Sometimes it is convenient to change the language definition of a website without the installation/configuration of extra modules/languages. For example if you create a copy of a very simple informational website and you want to change its language without touching language settings/modules.

The language attributes typically can be found in the following file:


$variables['html_attributes']['lang'] = $language_interface->getId();



Drupal themes to be compared