function Heading::getDynamicPluginConfig

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

Filters the header options to those chosen in editor config.

Overrides CKEditor5PluginDefault::getDynamicPluginConfig

File

core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Heading.php, line 172

Class

Heading
CKEditor 5 Heading plugin.

Namespace

Drupal\ckeditor5\Plugin\CKEditor5Plugin

Code

public function getDynamicPluginConfig(array $static_plugin_config, EditorInterface $editor) : array {
    $enabled_headings = $this->getEnabledHeadings();
    $all_heading_options = $static_plugin_config['heading']['options'];
    $configured_heading_options = array_filter($all_heading_options, function ($option) use ($enabled_headings) {
        return in_array($option['model'], $enabled_headings, TRUE);
    });
    return [
        'heading' => [
            'options' => array_values($configured_heading_options),
        ],
    ];
}

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