Problem/Motivation
Form modes have 3 property paths that are not yet validatable:
vendor/bin/drush config:inspect --filter-keys=core.entity_form_mode.user.register --detail --list-constraints
➜ 🤖 Analyzing…
Legend for Data:
✅❓ → Correct primitive type, detailed validation impossible.
✅✅ → Correct primitive type, passed all validation constraints.
---------------------------------------------------------------- --------- ------------- ------ ---------------------------------------------------------------------------------------------
Key Status Validatable Data Validation constraints
---------------------------------------------------------------- --------- ------------- ------ ---------------------------------------------------------------------------------------------
core.entity_form_mode.user.register Correct 79% ✅❓ ValidKeys: '<infer>'
core.entity_form_mode.user.register: Correct Validatable ✅✅ ValidKeys: '<infer>'
core.entity_form_mode.user.register:_core Correct Validatable ✅✅ ValidKeys:
- default_config_hash
core.entity_form_mode.user.register:_core.default_config_hash Correct Validatable ✅✅ NotNull: { }
Regex: '/^[a-zA-Z0-9\-_]+$/'
Length: 43
↣ PrimitiveType: { }
core.entity_form_mode.user.register:cache Correct Validatable ✅✅ ↣ PrimitiveType: { }
core.entity_form_mode.user.register:dependencies Correct Validatable ✅✅ ValidKeys: '<infer>'
core.entity_form_mode.user.register:dependencies.module Correct NOT ✅❓ ❌ @todo Add validation constraints to ancestor type: config_dependencies
core.entity_form_mode.user.register:dependencies.module.0 Correct Validatable ✅✅ NotBlank: { }
ExtensionName: { }
ExtensionExists: module
↣ PrimitiveType: { }
core.entity_form_mode.user.register:description Correct Validatable ✅✅ Regex:
pattern: '/([^\PC\x09\x0a\x0d])/u'
match: false
message: 'Text is not allowed to contain control characters, only visible characters.'↣ PrimitiveType: { }
core.entity_form_mode.user.register:id Correct NOT ✅❓ ⚠️ @todo Add validation constraints to config entity type: core.entity_form_mode.*.*
core.entity_form_mode.user.register:label Correct Validatable ✅✅ Regex:
pattern: '/([^\PC])/u'
match: false
message: 'Labels are not allowed to span multiple lines or contain control characters.'
NotBlank: { }
↣ PrimitiveType: { }
core.entity_form_mode.user.register:langcode Correct Validatable ✅✅ NotNull: { }
Choice:
callback: 'Drupal\Core\TypedData\Plugin\DataType\LanguageReference::getAllValidLangcodes'↣ PrimitiveType: { }
core.entity_form_mode.user.register:status Correct Validatable ✅✅ ↣ PrimitiveType: { }
core.entity_form_mode.user.register:targetEntityType Correct NOT ✅❓ ⚠️ @todo Add validation constraints to config entity type: core.entity_form_mode.*.*
core.entity_form_mode.user.register:uuid Correct Validatable ✅✅ Uuid: { }
↣ PrimitiveType: { }
---------------------------------------------------------------- --------- ------------- ------ ---------------------------------------------------------------------------------------------
Steps to reproduce
- Get a local git clone of Drupal core
11.x
. composer require drupal/config_inspector
— or manually install https://www.drupal.org/project/config_inspector/releases/2.1.5 or newer (which supports Drupal 11!)composer require drush/drush
vendor/bin/drush config:inspect --filter-keys=core.entity_form_mode.user.register --detail --list-constraints
Proposed resolution
Add validation constraints to:
core.entity_form_mode.*.*:dependencies.module
core.entity_form_mode.*.*:id
core.entity_form_mode.*.*:targetEntityType
This requires looking at the existing code and admin UI (if any) to understand which values could be considered valid. Eventually this needs to be reviewed by the relevant subsystem maintainer.
For examples, search *.schema.yml
files for the string constraints:
😊
Reach out to @borisson_ or @wimleers in the #distributions-and-recipes
.
Remaining tasks
User interface changes
None.
API changes
None.
Data model changes
More validation 🚀
Release notes snippet
None.