Drupal

Blog

Get views row count in twig [drupal 8]

When using twig, sometimes you would like to know whether the view has results or not. This snippet shows you how.

Blog

Get drupal 8 hostname or base url

How do you get the base url of a drupal 8 website programmatically?

Blog

EntityQuery nodes with date field in drupal 8

Little snippet to show how to query nodes with f.e. condition of "1 week ago".

Blog

Date fields showing up in wrong language in drupal 8 [SOLVED]

In drupal 8 you can experience your datefields showing up in English instead of in the language of your website. This fixes it.

Blog

Redirect user on login to admin/content page in correct language

By default you get to see a strange screen saying how long your are a member. It is good practice to auto-redirect users on login to the /admin/content page. This snippet does the trick.

Blog

How to patch htaccess file in composer.json - drupal 8

A composer update of your drupal can override changes to your htaccess file. With this snippet you can patch it correctly.

Blog

How to add a javascript library to composer.json in drupal 8

It is seen as a bad practice to add complete libraries to your theme in drupal 8. You should add these as packages to your composer file.

Blog

Translate page title of custom controller in drupal 8

The page callback system in drupal 8 is considerably different from drupal 7. This snippet shows you how to show a title depending on your language.

Blog

How to change labels of date field in views exposed form

The typical 'from' 'to' datefields are not quite good for usability. With the following snippet you can change the labels.

Blog

Get (custom) config settings programmatically in drupal 8

This snippet shows how to get data stored in config.

Subscribe to Drupal