Problem/Motivation
Any field configured to use the domain_admin entity reference selection handler -- most notably the user field field_domain_admin shipped by this module -- reports "missing schema" rows on the Configuration Inspector page (admin/config/development/configuration/inspect/field.field.user.user.field_domain_admin/list):
field.field.user.user.field_domain_admin:settings.handler_settings.target_bundles: missing schema field.field.user.user.field_domain_admin:settings.handler_settings.auto_create: missing schema field.field.user.user.field_domain_admin:settings.handler_settings.sort: missing schema
Two underlying causes:
- No schema for the
domain_adminselection handler.domain.schema.ymldeclares schemas fordomain.record.*,views.filter.domain_filter, etc., but noentity_reference_selection.domain_admin. Drupal core falls back toentity_reference_selection.*, which only declarestarget_type, so the three handler_settings keys are unknown. - The install yml uses the legacy structure.
config/install/field.field.user.user.field_domain_admin.ymlplacestarget_bundlesandsortdirectly undersettingsinstead of nested undersettings.handler_settingsas required since Drupal 8.x. Core normalises this on import, but the install file should reflect the modern shape.
Steps to reproduce
- Install the Configuration Inspector module on a Drupal 11 site running Domain 3.x.
- Visit /admin/config/development/configuration/inspect/field.field.user.user.field_domain_admin/list.
- Observe three "missing schema" entries under
display.default.display_options.fields.{field}.handler_settings.*.
Proposed resolution
Two minimal edits in the domain submodule:
1. Add a schema entry in domain/config/schema/domain.schema.yml. DomainAdminSelection extends DomainSelection (which extends DefaultSelection) and exposes the same handler settings, so the entry is a one-line type alias:
entity_reference_selection.domain_admin: type: entity_reference_selection.default label: 'Domain administrator selection handler settings'
2. Realign the install yml in domain/config/install/field.field.user.user.field_domain_admin.yml to the modern handler_settings nesting with an explicit boolean auto_create: false:
settings: handler: 'domain_admin' handler_settings: target_bundles: null auto_create: false sort: field: weight direction: ASC
The schema entry alone clears the three missing-schema reports for every site (existing and fresh). The install yml realignment ensures fresh installs match the schema exactly so the inspector is clean immediately, without relying on core's legacy normalisation.
Procedure for existing sites
Sites that have been running this module for a while may end up with auto_create: 0 stored as integer (a historical artefact of legacy form values). After updating to the version with this fix applied, those sites will see one residual schema error on field.field.user.user.field_domain_admin:
settings.handler_settings.auto_create: variable type is integer but applied schema class is BooleanDataTo clear it:
- Visit /admin/config/people/accounts/fields/user.user.field_domain_admin (Manage fields, then Domain administrator, then Edit).
- Click Save settings without changing anything.
This triggers a FieldConfig save which merges the current handler defaults (auto_create is FALSE as boolean by default) and writes the field config back with the correct types. The Configuration Inspector page is clean immediately afterwards.
No update hook is included. The structural fix already covers fresh installs and the residual case clears on the first re-save.
Remaining tasks
- Review the MR.
- Ship in 3.x.
Test coverage
No new test added. The change is config schema only and is verified by Configuration Inspector returning no errors against field.field.user.user.field_domain_admin after applying the patch.
Issue fork domain-3589210
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mably commentedComment #4
mably commentedComment #5
mably commentedComment #7
mably commented