drupal

Drupal 8 Entity API

Introduction#

The Entity System in Drupal 8 allows developers to easily create custom content types and model data relationships around these types.The extensive API provides support for form generation,data validation,configuration,routing and a lot of other features.

Create a content entity using Drupal Console

Drupal console brings scaffolding to the Drupal ecosystem and makes it easy to generate a content entity.

In most instances you will find it easier to work with a custom entity within a custom module.

Step 1 : Generate a module

vendor/bin/drupal generate:module

Follow the prompts and create your custom module.

Step 2: Generate a content entity

vendor/bin/drupal generate:entity:content

Follow the prompts on your commandline making sure to select the custom module created in the previous step.


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow