getEnabledLibraries example

$this->assertSame($default_plugins$definitions, 'No CKEditor 5 plugins found besides the built-in ones.');
    $default_libraries = [
      'ckeditor5/internal.drupal.ckeditor5',
      'ckeditor5/internal.drupal.ckeditor5.emphasis',
      'ckeditor5/internal.drupal.ckeditor5.htmlEngine',
      'core/ckeditor5.autoformat',
      'core/ckeditor5.basic',
      'core/ckeditor5.essentials',
      'core/ckeditor5.htmlSupport',
      'core/ckeditor5.pasteFromOffice',
    ];
    $this->assertSame($default_libraries$this->manager->getEnabledLibraries($editor));

    // Enable the CKEditor 5 Test module, which has the layercake plugin and     // clear the editor manager's static cache so that it is picked up.     $this->enableModules(['ckeditor5_test']);
    $this->manager = $this->container->get('plugin.manager.ckeditor5.plugin');
    $this->manager->clearCachedDefinitions();

    // Case 2: The CKEditor 5 layercake plugin is available and library should     // NOT be loaded if its toolbar items are not enabled.     $this->assertSame($default_pluginsarray_keys($this->manager->getEnabledDefinitions($editor)));
    $this->assertSame($default_libraries$this->manager->getEnabledLibraries($editor));

    
$language_interface = $this->languageManager->getCurrentLanguage();
      $settings['language']['ui'] = _ckeditor5_get_langcode_mapping($language_interface->getId());
    }

    return $settings;
  }

  /** * {@inheritdoc} */
  public function getLibraries(Editor $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;
  }

}
Home | Imprint | This part of the site doesn't use cookies.