Drupal Tips and Tricks

The installation, configuration and the work with Drupal obviously brings some challenges. Within this section you find some Tips and Tricks which shall help you to make your work easier.

Install the administrator menu module to save time

Using the standard administration menu often requires you to click several times to get to the desired function. To make this process faster you can install the "Administration menu" which gives you a direct access to the different admin functions (drop-down menu).

Drupal administrator menu module

Don't use style.css for CSS modifications; create an alternative file

If you make CSS modifications in the style.css, they will be overwritten if you install a new version of a theme. To avoid such problems it is highly recommended to make modifications in an alternative .css file.

Install Drupal on your local machine(s)

Installing Drupal on your local machine(s) offers you manifold advantages. First of all, it allows you to work (much) faster compared to when working online. Secondly, it offers you the perfect playground to experiment and test things.

Back up your database

Install the module Backup and Migrate to back up your Drupal site. This is probably the easiest way to back up and restore your Drupal MySQL database.

Drupal module Backup and Migrate

Experiment

The best way to learn anything new is by doing. Just start working on whatever it is you’re trying to do. Start small, just do! To experiment and play around you can install Drupal on your local machine(s).

Use the Drupal module "jQuery AJAX Load" for a quick and easy AJAX integration

jQuery AJAX Load is an helper module for easy loading any content using build in jQuery load function. It allows you for a quick and easy Ajax integration.

Just enable the module and add class .jquey_ajax_load to any link, URL content (without other regions) will be loaded on #jquery_ajax_load_target element. Those classes and id could be personalized to your needs. Target element coould be set on a per-link basis using the data-target attribute to define a valid jQuery ID.

Drupal jQuery AJAX Load

Meta Tags in Drupal 8: Special elements beyond nodes/taxonomies/views

Meta tags in Drupal 7 was super easy: With the modules Meta Tag and Meta Tags Quick you could do anything. In Drupal 8 the module meta tag covers the standard cases but meta tags quick is not available in a usable version. So what to do?

Drupal module context metadata

Drupal Views: Exclude current node from a list view

In some situations, for example a block listing nodes related to the node being viewed, you might wish to exclude the current node from a list view.

Views 3

Drupal Views

Drupal 8: Mismatched entity and/or field definitions

If you get the warning "Entity/field definitions Mismatch detected Mismatched entity and/or field definitions." after upgrading (for example from 8.37 to 8.45 i.e. required security update) you have to fix this issue first before running database updates. If you don't you might get into unresolvable problems. The solution is easy.

1. Adapt index.php

Add the following script before $response->send(); in index.php file(located in Drupal root folder)

Drupal 8: Mismatched entity and/or field definitions

Trobleshooting computed field with Drupal 8 (Drupal core 8.3.2; May 2017)

  • 8.x-1.0-alpha1 does not work with Drupal core 8.3.2 (you'll get unexpected errors) >> Choose 8.x-2.x-dev
  • Computed fields don't display on content types which existed prior the module is installed >> Create a new content type and everything works smoothly

Important: The field only updates when the node is saved (Cron, clear cache and similar not enough)

Drupal Computed field

Pages

Drupal themes to be compared