Skip to content

Introduction

This guide documents the process of creating a custom entity type in Drupal 11 using the example of an Event entity type.

You can reach this guide at https://git.io/d8entity. If you find any errors or have improvement suggestions, feel free to open an issue or pull request in the source repository.

The starting point is a stock Drupal 11 Core Standard installation with the contributed Entity API available at modules/contrib/entity and an empty module directory at modules/custom/event. See the installation instructions on Drupal.org for more information on installing Drupal.

Having Drush 13 available is required to follow along. When Drush commands are to be run, run them from within the Drupal installation. When PHP code is to be executed, you can create a script file in the project root, for example event.php, paste the given PHP code into the file and then running the script with drush php:script, for example drush php:script event.php.