Module Development

Entity API Implementation Basics for Drupal 8, 9, 10, and 11

Entities are the building blocks that make up just about everything on a Drupal site. Regardless of whether entities provide configuration information or content, they are absolutely crucial to Drupal's data model.

In this tutorial we'll:

  • Look at the overall class hierarchy between the various entity types to see how they're related.
  • Examine differences between configuration and content entities in the code that defines them.
  • Look at some of the core code required to create an entity type.

By the end of this lesson you should be able to use an example to create a custom entity type in code.