Allow specifying a prefix for ConfigExistsConstraint, to enable using it for references to config entities

Created on 19 February 2024, 4 months ago
Updated 13 March 2024, 4 months ago

Problem/Motivation

✨ Add validation constraints to config_entity.dependencies Fixed added the new ConfigExists constraint. It works well πŸ‘

But it does not support one very common use case: for one config entity to reference another config entity by its ID/name rather than the full config dependency name.

For example:

  1. bundle: article in core/profiles/standard/config/install/core.entity_view_display.node.article.default.yml must be prefixed by node.type. for it to be able to use ConfigExistsConstraint
  2. format: basic_html in core/profiles/demo_umami/config/install/editor.editor.basic_html.yml must be prefixed by filter.format. for it to be able to use ConfigExistsConstraint
  3. field: body in core/profiles/demo_umami/config/install/field.field.node.article.body.yml must be prefixed by field.storage.node for it to be able to use ConfigExistsConstraint
  4. et cetera

Hence this blocks:

Steps to reproduce

N/A

Proposed resolution

  1. Update ConfigExistsConstraint to accept an optional prefix
  2. Update ConfigExistsConstraintValidator to respect the prefix option.
  3. Test coverage, of course

Remaining tasks

User interface changes

None.

API changes

The ConfigExists constraint (added in Drupal 10.1) has a new prefix option which allows it to be used for validating references to a specific config entity. CR: https://www.drupal.org/node/3416240 β†’ .

Data model changes

None.

Release notes snippet

✨ Feature request
Status

Fixed

Version

10.3 ✨

Component
ConfigurationΒ  β†’

Last updated about 3 hours ago

Created by

πŸ‡§πŸ‡ͺBelgium Wim Leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024