function CKEditor5PluginManager::getPluginConfiguration

Same name in other branches
  1. 9 core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php \Drupal\ckeditor5\Plugin\CKEditor5PluginManager::getPluginConfiguration()
  2. 11.x core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php \Drupal\ckeditor5\Plugin\CKEditor5PluginManager::getPluginConfiguration()

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

File

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

Class

CKEditor5PluginManager
Provides a CKEditor 5 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] ?? [];
}

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