function Heading::validChoices

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

Computes all valid choices for the "enabled_headings" setting.

Return value

string[] All valid choices.

See also

ckeditor5.schema.yml

1 string reference to 'Heading::validChoices'
ckeditor5.schema.yml in core/modules/ckeditor5/config/schema/ckeditor5.schema.yml
core/modules/ckeditor5/config/schema/ckeditor5.schema.yml

File

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

Class

Heading
CKEditor 5 Heading plugin.

Namespace

Drupal\ckeditor5\Plugin\CKEditor5Plugin

Code

public static function validChoices() : array {
    $cke5_plugin_manager = \Drupal::service('plugin.manager.ckeditor5.plugin');
    assert($cke5_plugin_manager instanceof CKEditor5PluginManagerInterface);
    $plugin_definition = $cke5_plugin_manager->getDefinition('ckeditor5_heading');
    assert($plugin_definition->getClass() === static::class);
    return array_diff(array_column($plugin_definition->getCKEditor5Config()['heading']['options'], 'model'), static::ALWAYS_ENABLED_HEADINGS);
}

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