Drupal

Blog

Node access issues with content moderation

When using content moderation, the view_unpblished module does not work. But I really needed to get a user role to see all nodes created of this type and have access to it. With the following snippet, I fixed this. 

Blog

How to forced uninstall a (missing) module using drush

Sometimes you forgot to uninstall a module when you removed it. To keep thing clean, uninstall the module using the following drush script.

Blog

Perform math calculation and add result to view programmatically [drupal 8]

A thing that is very nice about drupal 8 is the flexibility of views In this tutorial, a snippet about how to show a 'total' count of results of some number fields of a table.

Blog

Preview (image) file entities in file overview or views [drupal 8]

I encountered a problem while working on a big migration. The client wanted to reuse files and images, so I added entity browser functionality. The problem however was that views does not provide a preview image for files. Therefore I created a small module.

Blog

Delete all terms from vocabulary [drupal 8]

When importing tags, or when in development, you would sometimes need to delete all terms from a vocabulary. This snippet does the trick for you.

Blog

Link to a node in twig [drupal 8]

Twig is the theme engine in drupal 8 sites. This snippet how to link to nodes correctly, without using preprocess functions to do it.

Blog

Set format of date field in twig using drupal 8

Twig comes with quite some handy functionalities. Date formatting is an example. In this snippet an example of how to show the created date in a drupal 8 time format. 

Blog

Drupal 8 trim body text in twig

Sometimes you need a body text that is trimmed. No need to install contrib modules.

Blog

hook_views_pre_render: add javascript to view in drupal 8

Use global theme javascript only in a few occasions. You should make sure javascript is only used on the right places. This snippet shows you how to load javascript when a specific view is loaded only.

Blog

Create a batch process with interaction in drupal 8 [SOLVED ]

Batch processes give you a hard time when using them for the first time. This module example will handle every aspect of it!

Subscribe to Drupal