Problem/Motivation
As discussed for the beta blockers #2116363: [PP-1] Unified repository of field definitions (cache + API) and #1498720: Make FieldableDatabaseStorageController automatically generate tables for every defined entity type we need to bring the concept of storage fields (aka "FieldConfig" of configurable fields) to the Entity Field API. Thus, marking as beta-blocker-blocker.
Proposed resolution
The plan is to introduce FieldStorageDefinitionInterface
and have FieldDefinitionInterface
extend it. Then FieldConfig
should implement StorageFieldDefinitionInterface
, but stop implementing FieldDefinitionInterface
as it's lie. For the few situations where widgets need to use FieldConfig as fully-fledged fields we can provide a decorator class which contains the dumb-default implementations for remaining methods (name to be found). (Could be postponed to another issue if turns out be hard.)
Finally, the FieldConfig class should receive (yet another) rename to match the new interface name, i.e. become StorageFieldConfig. yched suggested and we agreed that FieldInstance should be FieldConfig then - but as this has high documentation and community term changes we decided to postpone this.
For providing field storage definitions, we need a new hook + getters on the Entity Manager along with hook_entity_field_info(). As there is no use case for providing field storage base fields we do not add a respective methods on entity class for now.
(Replaced the initially suggested term FieldStorageDefinition with StorageFieldDefinition, as suggested in #12)
Remaining tasks
Follow-up: #2228187: Rename FieldConfig to and FieldInstance
User interface changes
-
API changes
FieldItemInterface::propertyDefinitions() receives a definition object implementing StorageFieldDefinitionInterface
instead of a FieldDefinitionInterface
now
FieldItemInterface::schema() receives a definition object implementing StorageFieldDefinitionInterface
instead of a FieldDefinitionInterface
now