public function CKEditor::getLibraries in Drupal 9
Same name and namespace in other branches
- 8 core/modules/ckeditor/src/Plugin/Editor/CKEditor.php \Drupal\ckeditor\Plugin\Editor\CKEditor::getLibraries()
Returns libraries to be attached.
Because this is a method, plugins can dynamically choose to attach a different library for different configurations, instead of being forced to always use the same method.
Parameters
\Drupal\editor\Entity\Editor $editor: A configured text editor object.
Return value
array An array of libraries that will be added to the page for use by this text editor.
Overrides EditorPluginInterface::getLibraries
See also
\Drupal\Core\Render\AttachmentsResponseProcessorInterface::processAttachments()
EditorManager::getAttachments()
File
- core/
modules/ ckeditor/ src/ Plugin/ Editor/ CKEditor.php, line 408
Class
- CKEditor
- Defines a CKEditor-based text editor for Drupal.
Namespace
Drupal\ckeditor\Plugin\EditorCode
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;
}