Drupal

Blog

Drupal 8: get the current path alias

Where in drupal 7 you would typically use something like drupal_get_path_alias(), this is different in drupal 8.

Blog

How to access a field value from entity (or node) object in drupal 8, 9 & 10

Discover how to access field values from entity or node objects in Drupal 8 and 9, covering regular text, link, entity reference, image, date, boolean, and list fields.

Blog

Get parameter from url in drupal 8 [solved]

Short snippet that shows how to get url parameters in drupal 8. Where in drupal 7 you would have to do some $_GET or work with args(0), you now have a clean function to do this.

Blog

How to use image styles in Twig on drupal 8

I had to loop over some images in Twig and dynamically adding image styles to them. Without using contrib this seemed a bit hard to do. I found a fix and I share it here with you.

Blog

How to add github repository to composer.json to be used as library in drupal 8 [SOLVED]

A common issue you would have when using javascript plug-ins is that you do not want them to be added to your version control. You would want to add it to the main composer.json file that has to donwload the library for you. Here is how the solution works.

Blog

Delete all users of a role in drupal 8

Simple snippet on how to delete all users of a given role.

Blog

Fixing the system.site uuid on config import problem in drupal 8

One thing that bothers me quite a lot is the error when you try to import existing configuration into a new drupal 8 website. I resolved this by adding a custom drush command that gets fired right before config import.

Blog

Set link field programmatically in drupal 8

Saving a link field is quite different from saving a text value in drupal 8. here's how its done.

Blog

Set geolocation field programmatically in drupal 8 [solved]

Populating geolocation field programmatically in drupal 8 is different from normal field values. This snippet does the trick:

Subscribe to Drupal