Introduction to Entity API in Drupal 8
For the Drupal 7 Entity API: Go here.
The Entity System was introduced late in the Drupal 7 development cycle with basic standards for how entities were loaded. The contributed entity.module expanded the API further by adding support for saving and deleting entities and many other improvements.
The majority of those improvements are now included in Drupal 8. Entity validation is now in its own API (which could validate an Entity saved via REST, rather than a form, for example).
The Drupal 8 entity system
|Entities are typed classes with methods|
|Entity type specific methods||
Both types are defined and documented in interfaces.
Entities are supported by handlers.
Storage handler - Supports loading, saving and deleting entities. This includes default support for revisions, translations and configurable fields.
Additionally, there are other handlers such as for access control, viewing, listings and forms.
Entity types in core comes in two variants.
- Configuration Entity
- Used by the Configuration System. Supports translations and can provide custom defaults for installations.
- Content Entity
- Consist of configurable and base fields, can have revisions and support translations.
This page is still a stub, documentation is being written while the Entity API is finalized for Drupal 8.
- - Storage
- - Access
- - Forms
- - View Builder
- - List
- Configuration entities
- Content entities
- - Revisions
- - Translations
- - Fields
- UUID support
- Entity query
Drupal 8 Entity API issues being worked on:
- _#1234567: Entity Forms API