Configuration entities use the Entity API to store configuration in the database.
Differences Compared to Content Entities
- Integrated with the CMI API for exportability
 - No fields
 - Uses a schema file (Content Entities use hook_schema())
 
Tutorials
This cheat sheet provides an overview of commonly used methods, classes, and interfaces for content entities.
![]()
Audience
This documentation is primarily intended for developers experienced in object-oriented PHP, Drupal 6 or Drupal 7, and for those looking to explore the principles of Drupal 8.
The guide to creating a content entity type in Drupal 8 contains a full list of available options.
Building a Bundle-less Content Type in Drupal 8
In this case, we are creating a Drupal 8 content entity that does not have any bundles.
This page is a copy of Enable-by-default configuration in a Drupal 8 module. This should be considered deprecated.
Creating a custom content type has become quite straightforward thanks to the new Configuration API provided by Drupal 8.
Sometimes, when extracting a content type from a custom module, you may want to include fields associated with that content type. Automatically creating fields allows you to remove and reinstall on multiple sites without leaving behind unnecessary fields and ensures you don’t forget to add them. There are two ways to add these fields to your codebase, which we’ll cover here.
Sometimes, when extracting a content type from a custom module, you may want to include fields associated with that content type. Automatically creating fields allows you to remove and reinstall on multiple sites without leaving behind unnecessary fields and ensures you don’t forget to add them. There are two ways to add these fields to your codebase, which we’ll cover here.
Significant Improvement
- The Entity API now implements the Typed Data API
 
In this new implementation, the Entity API treats everything as a field based on the same API, making entities predictable and consistent.
Placeholder landing page, just to outline the various child pages we’ll need.
For now, see: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21entity.api.php/group/entity_api/8.
Defining and Using Content Entity Field Definitions
Content entities must explicitly define all their fields by providing field definitions in the entity class. Field definitions are based on the Typed Data API (see also How Entities Implement It).
In Drupal 8, field language is no longer exposed via the public API. Instead, fields are attached to language-aware objects from which they "inherit" their language.
The key benefits here are: