// The single element for which source editing is enabled, which we are
// checking now.
$source_enabled_element = HTMLRestrictions::
fromString($value);
// Test for empty allowed elements with resolved wildcards since, for the
// purposes of this validator, HTML restrictions containing only wildcards
// should be considered empty.
// @todo Remove this early return in
// https://www.drupal.org/project/drupal/issues/2820364. It is only
// necessary because CKEditor5ElementConstraintValidator does not run
// before this, which means that this validator cannot assume it receives
// valid values.
if (count($source_enabled_element->
getAllowedElements()) !== 1
) { return;
} $enabled_plugin_overlap =
$enabled_plugin_elements->
intersect($source_enabled_element);
$disabled_plugin_overlap =
$disabled_plugin_elements // Merge the enabled plugins' elements, to allow wildcards to be resolved.
->
merge($enabled_plugin_elements) // Compute the overlap.
->
intersect($source_enabled_element) // Exclude the enabled plugin tags from the overlap; we merged these
// previously to be able to resolve wildcards.