function CKEditor::getLibraries

Same name in other branches
  1. 8.9.x core/modules/ckeditor/src/Plugin/Editor/CKEditor.php \Drupal\ckeditor\Plugin\Editor\CKEditor::getLibraries()

Overrides EditorPluginInterface::getLibraries

File

core/modules/ckeditor/src/Plugin/Editor/CKEditor.php, line 426

Class

CKEditor
Defines a CKEditor-based text editor for Drupal.

Namespace

Drupal\ckeditor\Plugin\Editor

Code

public function getLibraries(Editor $editor) {
    $libraries = [
        'ckeditor/drupal.ckeditor',
    ];
    // Get the required libraries for any enabled plugins.
    $enabled_plugins = array_keys($this->ckeditorPluginManager
        ->getEnabledPluginFiles($editor));
    foreach ($enabled_plugins as $plugin_id) {
        $plugin = $this->ckeditorPluginManager
            ->createInstance($plugin_id);
        $additional_libraries = array_diff($plugin->getLibraries($editor), $libraries);
        $libraries = array_merge($libraries, $additional_libraries);
    }
    return $libraries;
}

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