function Style::getDynamicPluginConfig

Same name in other branches
  1. 9 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Style.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Style::getDynamicPluginConfig()
  2. 10 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Style.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Style::getDynamicPluginConfig()

Overrides CKEditor5PluginDefault::getDynamicPluginConfig

File

core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Style.php, line 162

Class

Style
CKEditor 5 Style plugin configuration.

Namespace

Drupal\ckeditor5\Plugin\CKEditor5Plugin

Code

public function getDynamicPluginConfig(array $static_plugin_config, EditorInterface $editor) : array {
    $definitions = [];
    foreach ($this->configuration['styles'] as $style) {
        [
            $tag,
            $classes,
        ] = self::getTagAndClasses(HTMLRestrictions::fromString($style['element']));
        // Transform configured styles to the configuration structure expected by
        // the CKEditor 5 Style plugin.
        $definitions[] = [
            'name' => $style['label'],
            'element' => $tag,
            'classes' => $classes,
        ];
    }
    return [
        'style' => [
            'definitions' => $definitions,
        ],
    ];
}

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