Blog

Set frontpage programmatically in drupal 8 & 9

Snippet to programmatically set the frontpage

Blog

Give only custom block access but not block overview in drupal 8

Personally I do not like giving block access to website editors. In this one case, there was a need to edit custom blocks. I granted access to administer blocks, but I blocked access to the overview page with this EventSubscriber.

Blog

Get current user role in drupal 8 or 9

Getting the current user role in code is quite easy, here's the snippet.

Blog

Query nodes in drupal 8 & 9

A simple query example for drupal 8 and 9.

Blog

Apply patch in composer without updating other modules

Patching workflow in drupal is something you need to learn a bit. I stumbled on a few cases where I would have to update one module only and want to prevent from updating the entire system. Here's the snippet

Blog

Log messages in drupal 8 & 9

Loggin is very important. These snippets need to be used, be as precise as possible.

Blog

Patching workflow in drupal 8 & 9

How do we correctly patch our core and modules in drupal?

Blog

Get paragraph type in preprocess_paragraph in drupal 8 & 9

Preprocessing on paragraphs is not used very often. But when needed, here is a snippet that gets you the correct type to add some preprocessing.

Blog

Add body classes in drupal 8 & 9

There are two ways of adding body classes. The first is to add them in twig, the second is to provide additional classes in mytheme.theme.

Blog

Add the year to your page.html.twig file

Snippet to dynamically add the year to your page.html.twig file.

Subscribe to