What will you learn
- Overview of Entity API components and terminology
- Creating, reading, updating, and deleting entity data
- Practical examples of creating custom entities
- Using the EntityQuery service to find entities
- Overview of Field API components: field types, widgets, and formatters
- Working with field data in code
- Creating and managing custom fields
- Practical examples and use cases for field widgets and formatters
- Defining and using configuration data types
- Adding properties to a configuration entity
Overview
Drupal's Entity API offers a handy framework for defining, managing, and interacting with data objects (entities) in a consistent and extensible manner across the system.
Drupal's Field API provides a powerful system for defining, managing, and storing various types of structured data fields on entities, allowing for flexible content modeling and customization.
Configuration entities in Drupal are objects that store and manage configuration settings, allowing for exportable, deployable, and version-controlled configuration data within a Drupal site.
Drupal developer learning resources
Entities
In this course you’ll learn the foundational concepts and terminology of the Entity API, including the differences between configuration and content entities, and how to create, read, update, and delete entity data. We’ll cover practical examples of creating custom entities, implementing validation logic, and using hooks to interact with entity lifecycle operations. You will also learn how to use the EntityQuery service to find and manipulate subsets of data, and how to implement access control for entities. Additionally, the course will delve into the use of annotations and handlers, and how to leverage the Entity API for better performance and extensibility in your Drupal modules.
Fields
In this course you’ll learn the foundational concepts and components of the Field API, including how to define and manage field instances, field types, form widgets, and display formatters. The course will cover how to use the Field API to create custom fields, interact with field data programmatically, and alter field behavior using hooks. Additionally, you will explore the differences between base fields and user-defined fields, and how to leverage the Field API to build flexible and extensible data models in Drupal.
Configuration Entities
This course will cover the creation and management of configuration entities, including defining configuration data types, setting default configurations in modules, and providing initial settings with simple configuration. You will also learn how to create and manage settings forms, get and set configuration values within forms, and add properties to configuration entities. Additionally, the course will teach you how to load and save configuration entity data programmatically, ensuring you can effectively manage configuration data within your Drupal modules.