interface CKEditor5PluginManagerInterface

Same name in other branches
  1. 10 core/modules/ckeditor5/src/Plugin/CKEditor5PluginManagerInterface.php \Drupal\ckeditor5\Plugin\CKEditor5PluginManagerInterface
  2. 11.x core/modules/ckeditor5/src/Plugin/CKEditor5PluginManagerInterface.php \Drupal\ckeditor5\Plugin\CKEditor5PluginManagerInterface

Provides the interface for a plugin manager of CKEditor 5 plugins.

Hierarchy

Expanded class hierarchy of CKEditor5PluginManagerInterface

All classes that implement CKEditor5PluginManagerInterface

See also

\Drupal\ckeditor5\Plugin\CKEditor5PluginInterface

\Drupal\ckeditor5\Annotation\CKEditor5Plugin

Plugin API

4 files declare their use of CKEditor5PluginManagerInterface
CKEditor5.php in core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php
Heading.php in core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Heading.php
PluginManagerDependentValidatorTrait.php in core/modules/ckeditor5/src/Plugin/Validation/Constraint/PluginManagerDependentValidatorTrait.php
SmartDefaultSettings.php in core/modules/ckeditor5/src/SmartDefaultSettings.php

File

core/modules/ckeditor5/src/Plugin/CKEditor5PluginManagerInterface.php, line 17

Namespace

Drupal\ckeditor5\Plugin
View source
interface CKEditor5PluginManagerInterface extends DiscoveryInterface {
    
    /**
     * Returns a CKEditor 5 plugin with configuration from the editor.
     *
     * @param string $plugin_id
     *   The plugin ID.
     * @param \Drupal\editor\EditorInterface|null $editor
     *   The editor to load configuration from.
     *
     * @return \Drupal\ckeditor5\Plugin\CKEditor5PluginInterface
     *   The CKEditor 5 plugin instance.
     */
    public function getPlugin(string $plugin_id, ?EditorInterface $editor) : CKEditor5PluginInterface;
    
    /**
     * Gets a list of all toolbar items.
     *
     * @return string[]
     *   List of all toolbar items provided by plugins.
     */
    public function getToolbarItems() : array;
    
    /**
     * Gets a list of all admin library names.
     *
     * @return string[]
     *   List of all admin libraries provided by plugins.
     */
    public function getAdminLibraries() : array;
    
    /**
     * Gets a list of libraries required for the editor.
     *
     * This list is filtered by enabled plugins because it is needed at runtime.
     *
     * @param \Drupal\editor\EditorInterface $editor
     *   A configured text editor object.
     *
     * @return string[]
     *   The list of enabled libraries.
     */
    public function getEnabledLibraries(EditorInterface $editor) : array;
    
    /**
     * Filter list of definitions by enabled plugins only.
     *
     * @param \Drupal\editor\EditorInterface $editor
     *   A configured text editor object.
     *
     * @return array
     *   Enabled plugin definitions.
     */
    public function getEnabledDefinitions(EditorInterface $editor) : array;
    
    /**
     * Searches for CKEditor 5 plugin that supports a given tag.
     *
     * @param string $tag
     *   The HTML tag to be searched for within plugin definitions.
     *
     * @return string|null
     *   The ID of the plugin that supports the given tag.
     */
    public function findPluginSupportingElement(string $tag) : ?string;
    
    /**
     * Gets the configuration for the CKEditor 5 plugins enabled in this editor.
     *
     * @param \Drupal\editor\EditorInterface $editor
     *   A configured text editor object.
     *
     * @return array[]
     *   An array with two key-value pairs:
     *   1. 'plugins' lists all plugins to load
     *   2. 'config' lists the configuration for all these plugins.
     *
     * @see https://ckeditor.com/docs/ckeditor5/latest/api/module_editor-classic_classiceditor-ClassicEditor.html
     *
     * @see \Drupal\ckeditor5\Plugin\Editor\CKEditor5::getJSSettings()
     */
    public function getCKEditor5PluginConfig(EditorInterface $editor) : array;
    
    /**
     * Gets all supported elements for the given plugins and text editor.
     *
     * @param string[] $plugin_ids
     *   (optional) An array of CKEditor 5 plugin IDs. When not set, gets elements
     *   for all plugins.
     * @param \Drupal\editor\EditorInterface|null $editor
     *   (optional) A configured text editor object using CKEditor 5. When not
     *   set, plugins depending on the text editor cannot provide elements.
     * @param bool $resolve_wildcards
     *   (optional) Whether to resolve wildcards. Defaults to TRUE. When set to
     *   FALSE, the raw allowed elements will be returned (with no processing
     *   applied hence no resolved wildcards).
     * @param bool $creatable_elements_only
     *   (optional) Whether to retrieve only the creatable elements. Defaults to
     *   FALSE.
     *
     * @return array
     *   A nested array with a structure as described in
     *   \Drupal\filter\Plugin\FilterInterface::getHTMLRestrictions().
     *
     * @see \Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition::getCreatableElements()
     *
     * @throws \LogicException
     *   Thrown when an invalid CKEditor5PluginElementsSubsetInterface
     *   implementation is encountered.
     *
     * @see \Drupal\filter\Plugin\FilterInterface::getHTMLRestrictions()
     */
    public function getProvidedElements(array $plugin_ids = [], EditorInterface $editor = NULL, bool $resolve_wildcards = TRUE, bool $creatable_elements_only = FALSE) : array;

}

Members

Title Sort descending Modifiers Object type Summary Overrides
CKEditor5PluginManagerInterface::findPluginSupportingElement public function Searches for CKEditor 5 plugin that supports a given tag. 1
CKEditor5PluginManagerInterface::getAdminLibraries public function Gets a list of all admin library names. 1
CKEditor5PluginManagerInterface::getCKEditor5PluginConfig public function Gets the configuration for the CKEditor 5 plugins enabled in this editor. 1
CKEditor5PluginManagerInterface::getEnabledDefinitions public function Filter list of definitions by enabled plugins only. 1
CKEditor5PluginManagerInterface::getEnabledLibraries public function Gets a list of libraries required for the editor. 1
CKEditor5PluginManagerInterface::getPlugin public function Returns a CKEditor 5 plugin with configuration from the editor. 1
CKEditor5PluginManagerInterface::getProvidedElements public function Gets all supported elements for the given plugins and text editor. 1
CKEditor5PluginManagerInterface::getToolbarItems public function Gets a list of all toolbar items. 1
DiscoveryInterface::getDefinition public function Gets a specific plugin definition. 2
DiscoveryInterface::getDefinitions public function Gets the definition of all plugins for this type. 1
DiscoveryInterface::hasDefinition public function Indicates if a specific plugin definition exists.

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