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

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.

A boilerplate Drupal Entity file

I realized there are not many resources to find a boilerplate custom entity. Here I share a code snippet containing one.

How to fix "Mismatched entity and/or field definition" in Drupal.

This update script will help you in fixing Mismatched entity and/or field definitions errors in Drupal

Get the current Drupal version with Drush

This easy snippet can help you if you want information about your current drupal version

Subscribe to Drupal