Finalize API for creating, overriding, and altering code-defined bundle fields

Created on 28 September 2014, about 10 years ago
Updated 5 February 2023, almost 2 years ago

Problem/Motivation

  • ContentEntityInterface::bundleFieldDefinitions() and hook_entity_bundle_field_info() can return either bundle-specific overrides of base field definitions, or definitions of fields that are not base fields. In this issue, let's call the latter case "bundle fields".
  • HEAD's current example of hook_entity_bundle_field_info() creates a bundle field via BaseFieldDefinition::create(), but that is incorrect, because BaseFieldDefinition::isBaseField() returns TRUE, which is incorrect for a bundle field.
  • Core's only real implementation of bundle fields is via field_entity_bundle_field_info(), which implements them via config entities.
  • So, in theory, contrib modules can implement non-config-based bundle fields, but we don't provide an implementation class with which to do so.
  • Additionally, we have 'base_field_override' config entities for using config to override a code-defined base field, but do not have 'bundle_field_override' config entities for overriding code-defined bundle fields. So a contrib module attempting to implement a bundle field implementation would also need to implement a getConfig() method so that content_translation and contrib extensions like field_permissions could work on them.
  • And hook_entity_bundle_field_info_alter() has the same problem as πŸ› hook_entity_base_field_info_alter() and hook_entity_bundle_field_info_alter() are documented to get a parameter that doesn't implement an interface with setter methods Needs work .

Proposed resolution

Remaining tasks

Figure out how to fix all of the above.

User interface changes

API changes

πŸ“Œ Task
Status

Needs work

Version

10.1 ✨

Component
FieldΒ  β†’

Last updated 1 day ago

Created by

πŸ‡ΊπŸ‡ΈUnited States effulgentsia

Live updates comments and jobs are added and updated live.
  • API change

    Changes an existing API or subsystem. Not backportable to earlier major versions, unless absolutely required to fix a critical bug.

  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
Production build 0.71.5 2024