Blog

Comparing two dates in drupal the correct way

Comparing dates is a common action when programming. But you could have side effects mixing UTC and timezones... This snippet shows you how to do it the correct way.

Blog

Solve blurry text or wide font in ionic buttons

I've stumbled upon this issue on every ionic project so I'm logging it here.

Blog

Render a view with contextual filters programmatically in Drupal 9

A snippet of how to render a view inside a controller.

Blog

How to add class to Router link when active in Angular

Use the following to add an active class to a menu item or active link when you are visiting the exact page:

Blog

How to use HTML markup in hook_mail in drupal 9

I found a problem while sending confirmation e-mails. My HTML was escaped in translation strings. This fixed it.

Blog

How to check if a node entity is a newly save one

When working with entity forms I discovered this interesting piece detecting whether an entity is a newly saved one.

Blog

Directly get title of a referenced entity in Drupal 8 or 9

Entity references are common practice in drupal. With this snippet you can directly get the title of a referenced entity.

Blog

How to set default value of a drupal node form or entity form

Lately I had to prefill values on an entity form. Somewhat it did not work directly. Here is a working snippet.

Blog

How to set default value for entity reference programmatically in a form in drupal

Prefilling values is a common task. This snippet shows how to prefill a entity reference field

Blog

How to throw an exception to users in drupal

With custom development come a lot of entry points for users. This snippet throws access denied for users that are too curious on some paths.

Subscribe to