Entity API

Drupal 8 Entity API documentation.

Introduction to Entity API in Drupal 8

Introduction to Entity API in Drupal 8

Entity types

Drupal 7 - entities were generic stdClass objects.

Working with the Entity API

Syntax, usage, and method examples for the new Entity API.

Bundles

Also known as 'sub-type', a bundle is a type of container for information about fields or setting definitions.

Configuration Entity

Configuration entities uses the Entity API in order to keep configuration in the database.

Content Entity

This cheat sheet provides an overview of frequently used methods, classes and interfaces for content entities.

Creating a custom content entity

This page covers the basics programming necessary for creating a custom Content Entity with the Drupal 8 Entity API.

Creating a custom content type in Drupal 8

Guide to creating a 'Car Brand' custom content type in Drupal 8 using YAML files for module configuration and field setup

Programming custom fields into your content type

Sometimes when you're pulling in a content type from a custom module, you'd also like to pull in fields specific to this content type.

Using the UI to export the code for your custom fields

Sometimes when you're pulling in a content type from a custom module, you'd also like to pull in fields specific to this content type.

Entity API implements Typed Data API

Major improvement

Entity validation API

API for validating entity data during CRUD operations.

Access on entities (TBD)

Initial stub page, just to outline the different child-pages we need.

Defining and using Content Entity Field definitions

Content entities have to define all their fields explicitly by providing definitions on the entity class. The field definitions are based on

Entity Translation API

From Drupal 8 field language is no longer exposed in the public API, instead fields are attached to language-aware entity objects from which

Display Modes: View Modes and Form Modes

Introduction to display modes. Configuration Entities which provide different presentations for viewing and editing Content Entities.

FieldTypes, FieldWidgets and FieldFormatters

Examples for creating custom Field Types (data storage), Field Widgets (data input UI), and Field Formatters (data output UI).

Overview: Creating a custom field

Upgrading Code Snippets Module to Drupal 8: Creating a Custom Field

Dynamic/Virtual field values using computed field property classes

Sometimes it is necessary to have "computed" properties in a field, alongside actual values that are stored in the database. A good example

Handlers

Handlers provide mechanisms for Entities such as forms, output, data storage, Views integration, and more

Making an entity revisionable

Making an entity become revisionable is fairly simple, basically you just need to define the entity's revision table and mark the fields to

Structure of an Entity annotation

Entity types, both configuration and content entity are defined using annotation.

Creating a content entity type in Drupal 8

This page provides an example of how to create a content entity type, with administration management pages, for Drupal 8.

Making the content entity searchable

Stub page. Example code to follow

Converting a content entity type to be revisionable and publishable

This page explains the process of converting a content entity type to be revisionable and publishable.

Link Templates

Link templates provide URL paths for pages related to entities. Use standard templates and define custom ones.

Guide maintainers

berdir's picture
amateescu's picture
eojthebrave's picture