The ConfigExists validation constraint should support dynamic replacement tokens

Created on 9 April 2025, 12 days ago

Problem/Motivation

(Yeah, yeah, I know we're not supposed to call them "tokens", but come on. They're tokens.)

The ConfigExists validation constraint doesn't allow us to check for config whose prefix may contain a value seen elsewhere in the object being validated. A classic example is if you're creating something that references a particular node type. You can't do something like this in your schema:

bundle:
  constraints:
    ConfigExists:
      prefix: 'core.entity_view_mode.[%parent.entity_type_id].'

It'd be great if we could, and would help Experience Builder.

Proposed resolution

All the infrastructure for this already exists in \Drupal\Core\Config\Schema\TypeResolver. The ConfigExists constraint validator should call that on the constraint's $prefix option.

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component

configuration system

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024