How to upgrade from Drupal 8 to 9 with composer [blog post + screen cast]

This blogposts gives you a summary on how to upgrade to drupal 9 and fix all composer issues.

How to programmatically update an entity reference field in drupal 8

Drupal 8 is becoming more and more API-first based. This means a lot of imports and exports of data will be done. A thing you might face here, is that the updating of entity reference fields is a bit tricky. Here I'll show you how it is done.

Create paragraphs and attach to node programmatically in drupal 8

Paragraphs give great power to drupal 8. This code will show you how you can add them programmatically, for example when importing stuff.

Disable block caching in drupal 8

When creating custom blocks, sometimes you need to make sure the block is never cached f.e. when including dynamic links. 

Theming hooks for a custom entity

These snippets show you how to add hooks in order to generate twig files like mymodule/templates/my-entity--full.html.twig

How to add classes to link fields in twig

In the following examples, I loop over a tag field and set a link with classes 

Ho to check if a field is empty in Drupal 8

A common task in custom coding is checking whether a field had a value. This snippet helps you with that.

How to use bundle classes in drupal 9 & 10

Bundle classes have arrived! In my opinion a major change to drupal and the way we will do theming. Introduced in branch 9.3.x.

Subscribe to Drupal