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.

"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.

File entity module: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'DATABASENAME.image_dimensions' doesn't exist: SELECT * FROM {image_dimensions} id WHERE id.fid IN (:fids_0); Array ( [:fids_0] => 444 ) in file_entity_file_load() (Zeile 225 von /DRUPALROOT/sites/all/modules/media/file_entity/file_entity.module).

Same for me, after the update to Media 7.1.4, that I did following PSA-2014-001.

How to make a click-to-call link for mobile Devices only using HTML/CSS

<div class="mobiletel"><a href="tel:+xxxxxxxxx">(00xx x) xxx xx xx</a></div>
<div class="desktoptel">(00xx x) xxx xx xx</div>

@media only screen and (max-device-width: 480px) {
.desktoptel {display:none;}

@media (min-device-width: 481px) {
.mobiletel {display:none;}

How to create a Drupal view with future events / dates of nodes

All you have to do is create a new view that shows content of type 'event'... set that on the first page of creating your view. Make sure you check the 'block' option at the bottom - it's up to you whether you also want to create a page display or not, that's checked by default. Also, before moving onto the second page, make sure that your view is a list of 'fields' rather than 'teasers'.

How to create a Drupal view with future events/dates

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

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