You are here

protected static function CKEditor5PluginManager::getPluginConfiguration in Drupal 10

Gets the plugin configuration (if any) from a text editor config entity.

Parameters

\Drupal\editor\EditorInterface $editor: A text editor config entity that is using CKEditor 5.

string $plugin_id: A CKEditor 5 plugin ID.

Return value

array The CKEditor 5 plugin configuration, if any.

Throws

\InvalidArgumentException Thrown when the method is called with any other text editor than CKEditor 5.

1 call to CKEditor5PluginManager::getPluginConfiguration()
CKEditor5PluginManager::getPlugin in core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
Returns a CKEditor 5 plugin with configuration from the editor.

File

core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php, line 93

Class

CKEditor5PluginManager
Provides a CKEditor5 plugin manager.

Namespace

Drupal\ckeditor5\Plugin

Code

protected static function getPluginConfiguration(EditorInterface $editor, string $plugin_id) : array {
  if ($editor
    ->getEditor() !== 'ckeditor5') {
    throw new \InvalidArgumentException('This method should only be called on text editor config entities using CKEditor 5.');
  }
  return $editor
    ->getSettings()['plugins'][$plugin_id] ?? [];
}