Module Development

Modify Existing Entities with Alter Hooks for Drupal 8, 9, 10, and 11

On occasion you may need to modify the behavior of entity types defined by another module. Thankfully Drupal includes several alter hooks that can be used to override the behavior of another entity.

In this tutorial we will:

  • Walk through the common Entity API hooks
  • Look at example implementations of each
  • And discuss the use cases for each

By the end of this tutorial you will have a better understanding of how to override the default behavior of an entity type provided by Drupal core (or another contributed module) within your custom code.