You are here

public function SourceEditing::getDynamicPluginConfig in Drupal 10

File

core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/SourceEditing.php, line 95

Class

SourceEditing
CKEditor 5 Source Editing plugin configuration.

Namespace

Drupal\ckeditor5\Plugin\CKEditor5Plugin

Code

public function getDynamicPluginConfig(array $static_plugin_config, EditorInterface $editor) : array {
  $restrictions = HTMLRestrictions::fromString(implode(' ', $this->configuration['allowed_tags']));

  // Only handle concrete HTML elements to allow the Wildcard HTML support
  // plugin to handle wildcards.
  // @see \Drupal\ckeditor5\Plugin\CKEditor5PluginManager::getCKEditor5PluginConfig()
  $concrete_restrictions = $restrictions
    ->getConcreteSubset();
  return [
    'htmlSupport' => [
      'allow' => $concrete_restrictions
        ->toGeneralHtmlSupportConfig(),
    ],
  ];
}