// CKEditor 5 interprets wildcards from a "CKEditor 5 model element"
// perspective, Drupal interprets wildcards from a "HTML element"
// perspective. GHS is used to reconcile those two perspectives, to ensure
// all expected HTML elements truly are supported.
// The `ckeditor5_wildcardHtmlSupport` is automatically enabled when
// necessary, and only when necessary.
// @see \Drupal\ckeditor5\Plugin\CKEditor5PluginManager::getEnabledDefinitions()
if (isset($definitions['ckeditor5_wildcardHtmlSupport'
])) { $allowed_elements =
new HTMLRestrictions($this->
getProvidedElements(array_keys($definitions),
$editor, FALSE
));
// Compute the net new elements that the wildcard tags resolve into.
$concrete_allowed_elements =
$allowed_elements->
getConcreteSubset();
$net_new_elements =
$allowed_elements->
diff($concrete_allowed_elements);
$config['ckeditor5_wildcardHtmlSupport'
] =
[ 'htmlSupport' =>
[ 'allow' =>
$net_new_elements->
toGeneralHtmlSupportConfig(),
],
];
} return [ 'plugins' =>
$this->
mergeDefinitionValues('getCKEditor5Plugins',
$definitions),
'config' => NestedArray::
mergeDeepArray($config),
];
}