Presented at DrupalCon Vienna 2017 (26-29 September 2017), this talk explains why Drupal's Typed Data API and Configuration Schema matter and how they unlock Configuration Translation, Search API indexing, and Configuration Views.
Why Typed Data & Configuration Schema Matter#
- Configuration Translation: Automatically knows which configuration keys are human-readable labels vs system booleans or integers.
- Search API: Maps entity and field properties cleanly to typed index fields (Boolean, Date, Decimal, Integer, String, Fulltext).
- Configuration Views: Enables Views-based listings and operations over configuration entities.
Typed Data API#
- Built around
@DataTypeplugins, theTypedDataManagerservice, andFieldTypePluginManager. - Core interfaces:
TypedDataInterface,ComplexDataInterface(named/typed properties),PrimitiveInterface(URL, Timestamp, etc.), andListInterface. - Data definitions (
DataDefinitionInterface,ListDataDefinition,EntityDataDefinition) separate what a data type is from how it is used.
Configuration Schema#
Defined alongside module config (for example user.settings.yml paired with user.schema.yml), Configuration Schema describes config_object mappings, types (label, boolean, string, integer), and human-readable labels.
Key Benefits#
- Clearer, self-documenting data structures.
- Extensible metadata and behaviours (such as translation).
- Better developer experience (DX) with generic
get,set, and validation APIs. - Automatic typecasting of configuration values on save and translation of default configuration.
