function SourceEditing::getDynamicPluginConfig

Same name and namespace in other branches
  1. 9 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/SourceEditing.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\SourceEditing::getDynamicPluginConfig()
  2. 11.x core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/SourceEditing.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\SourceEditing::getDynamicPluginConfig()

Overrides CKEditor5PluginDefault::getDynamicPluginConfig

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(),
      // Any manually created elements are explicitly allowed to be empty.
'allowEmpty' => array_keys($concrete_restrictions->getAllowedElements()),
    ],
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.