function CKEditor5::getLibraries

Same name and namespace in other branches
  1. 9 core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php \Drupal\ckeditor5\Plugin\Editor\CKEditor5::getLibraries()
  2. 11.x core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php \Drupal\ckeditor5\Plugin\Editor\CKEditor5::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

File

core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php, line 969

Class

CKEditor5
Defines a CKEditor 5-based text editor for Drupal.

Namespace

Drupal\ckeditor5\Plugin\Editor

Code

public function getLibraries(EditorEntity $editor) {
  $plugin_libraries = $this->ckeditor5PluginManager
    ->getEnabledLibraries($editor);
  if ($this->moduleHandler
    ->moduleExists('locale')) {
    $language_interface = $this->languageManager
      ->getCurrentLanguage();
    $plugin_libraries[] = 'core/ckeditor5.translations.' . _ckeditor5_get_langcode_mapping($language_interface->getId());
  }
  return $plugin_libraries;
}

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