interface CKEditor4To5UpgradePluginInterface

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

Defines an interface for CKEditor 4 to 5 upgrade plugins.

Hierarchy

Expanded class hierarchy of CKEditor4To5UpgradePluginInterface

All classes that implement CKEditor4To5UpgradePluginInterface

See also

\Drupal\ckeditor5\Plugin\CKEditor4To5UpgradePluginManager

\Drupal\ckeditor5\Annotation\CKEditor4To5Upgrade

Plugin API

2 files declare their use of CKEditor4To5UpgradePluginInterface
Contrib.php in core/modules/ckeditor5/src/Plugin/CKEditor4To5Upgrade/Contrib.php
Core.php in core/modules/ckeditor5/src/Plugin/CKEditor4To5Upgrade/Core.php

File

core/modules/ckeditor5/src/Plugin/CKEditor4To5UpgradePluginInterface.php, line 18

Namespace

Drupal\ckeditor5\Plugin
View source
interface CKEditor4To5UpgradePluginInterface extends PluginInspectionInterface {
    
    /**
     * Maps a CKEditor 4 button to the CKEditor 5 equivalent, if it exists.
     *
     * Generated by inspecting all \Drupal\ckeditor\CKEditorPluginButtonsInterface
     * implementations.
     *
     * @param string $cke4_button
     *   A valid CKEditor 4 button name.
     * @param \Drupal\ckeditor5\HTMLRestrictions $text_format_html_restrictions
     *   The restrictions of the text format, if this upgrade plugin needs to
     *   inspect the text format's HTML restrictions to make a decision.
     *
     * @return string[]|null
     *   The equivalent CKEditor 5 toolbar items, or NULL if no equivalent exists.
     *   In either case, the button names must be added to the annotation.
     *
     * @throws \OutOfBoundsException
     *   Thrown when this plugin does not know whether an equivalent exists.
     *
     * @see \Drupal\ckeditor\CKEditorPluginButtonsInterface
     * @see \Drupal\ckeditor5\Annotation\CKEditor4To5Upgrade
     */
    public function mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem(string $cke4_button, HTMLRestrictions $text_format_html_restrictions) : ?array;
    
    /**
     * Maps CKEditor 4 settings to the CKEditor 5 equivalent, if needed.
     *
     * Not every CKEditor 5 plugin has settings; some CKEditor 5 plugins may have
     * settings that the CKEditor 4 equivalent did not and vice versa. Therefore
     * the complete CKEditor 4 settings are provided, and any CKEditor 5 setting
     * can be set.
     *
     * @param string $cke4_plugin_id
     *   The CKEditor 4 plugin whose settings need to be mapped.
     * @param array $cke4_plugin_settings
     *   The settings for this CKEditor 4 plugin.
     *
     * @return array|null
     *   NULL if not needed, otherwise an array with a single key-value pair:
     *   - key: the plugin ID of the equivalent CKEditor 5 plugin
     *   - value: the equivalent settings
     *   In either case, the button name must be added to the annotation.
     *
     * @throws \OutOfBoundsException
     *   Thrown when this plugin does not know whether an equivalent exists.
     *
     * @see \Drupal\ckeditor\CKEditorPluginConfigurableInterface
     * @see \Drupal\ckeditor5\Annotation\CKEditor4To5Upgrade
     */
    public function mapCKEditor4SettingsToCKEditor5Configuration(string $cke4_plugin_id, array $cke4_plugin_settings) : ?array;
    
    /**
     * Computes elements subset configuration for CKEditor 5 plugin.
     *
     * Every CKEditor 5 plugin that implements the elements subset interface must
     * implement this as well, to ensure a smooth upgrade path.
     *
     * @param string $cke5_plugin_id
     *   The CKEditor 5 plugin whose subset configuration needs to be computed.
     * @param \Drupal\filter\FilterFormatInterface $text_format
     *   The text format based on whose restrictions this should be computed.
     *
     * @return array|null
     *   NULL if not needed, otherwise a configuration array (which can itself be
     *   a subset of the default configuration of this CKEditor 5 plugin: perhaps
     *   only some of the configuration values determine the subset).
     *
     * @throws \OutOfBoundsException
     *   Thrown when no upgrade path exists.
     * @throws \LogicException
     *   Thrown when a plugin claims to provide an upgrade path but does not.
     *
     * @see \Drupal\ckeditor5\Plugin\CKEditor5PluginElementsSubsetInterface
     * @see \Drupal\ckeditor5\Annotation\CKEditor4To5Upgrade
     */
    public function computeCKEditor5PluginSubsetConfiguration(string $cke5_plugin_id, FilterFormatInterface $text_format) : ?array;

}

Members

Title Sort descending Modifiers Object type Summary Overrides
CKEditor4To5UpgradePluginInterface::computeCKEditor5PluginSubsetConfiguration public function Computes elements subset configuration for CKEditor 5 plugin. 2
CKEditor4To5UpgradePluginInterface::mapCKEditor4SettingsToCKEditor5Configuration public function Maps CKEditor 4 settings to the CKEditor 5 equivalent, if needed. 2
CKEditor4To5UpgradePluginInterface::mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem public function Maps a CKEditor 4 button to the CKEditor 5 equivalent, if it exists. 2
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 6
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2

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