You are here

public function CKEditor5PluginManager::getPlugin in Drupal 10

Returns a CKEditor 5 plugin with configuration from the editor.

Parameters

string $plugin_id: The plugin ID.

\Drupal\editor\EditorInterface|null $editor: The editor to load configuration from.

Return value

\Drupal\ckeditor5\Plugin\CKEditor5PluginInterface The CKEditor 5 plugin instance.

Overrides CKEditor5PluginManagerInterface::getPlugin

3 calls to CKEditor5PluginManager::getPlugin()
CKEditor5PluginManager::getCKEditor5PluginConfig in core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
Gets the configuration for the CKEditor 5 plugins enabled in this editor.
CKEditor5PluginManager::getEnabledDefinitions in core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
Filter list of definitions by enabled plugins only.
CKEditor5PluginManager::getProvidedElements in core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
Gets all supported elements for the given plugins and text editor.

File

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

Class

CKEditor5PluginManager
Provides a CKEditor5 plugin manager.

Namespace

Drupal\ckeditor5\Plugin

Code

public function getPlugin(string $plugin_id, ?EditorInterface $editor) : CKEditor5PluginInterface {
  $configuration = $editor ? self::getPluginConfiguration($editor, $plugin_id) : [];
  return $this
    ->createInstance($plugin_id, $configuration);
}