Add FilteredPluginExistsConstraint constraint for validating Segment config entity

Created on 30 May 2025, about 2 months ago

Overview

Right now we are validating that a condition plugin for a Segment is allowed on runtime, but not at the config level.

This could eventually lead to consistence issues in edge-cases.

Proposed resolution

Add FilteredPluginExistsConstraint constraint:

Currently core's PluginExistsConstraintValidator does $definition = $constraint->pluginManager->getDefinition($plugin_id, FALSE);

This should be a similar validator but using getFilteredDefinitions. For that we need to validate the manager implements FilteredPluginManagerInterface.

The consumer should be another argument for the constraint so instead of:

          manager: plugin.manager.block
          interface: Drupal\Core\Block\BlockPluginInterface
          allowFallback: true

we would use:

        PluginExists:
          manager: plugin.manager.block
          interface: Drupal\Core\Block\BlockPluginInterface
          allowFallback: true
          consumer: 'xb_personalization'

Here in XB is fine, but wondering if this should be in core tbh.

User interface changes

None.

📌 Task
Status

Active

Version

0.0

Component

Personalization

Created by

🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

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

Comments & Activities

Production build 0.71.5 2024