You are here

public static function Heading::validChoices in Drupal 10

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);
}