interface EditorPluginInterface

Same name in other branches
  1. 9 core/modules/editor/src/Plugin/EditorPluginInterface.php \Drupal\editor\Plugin\EditorPluginInterface
  2. 8.9.x core/modules/editor/src/Plugin/EditorPluginInterface.php \Drupal\editor\Plugin\EditorPluginInterface
  3. 10 core/modules/editor/src/Plugin/EditorPluginInterface.php \Drupal\editor\Plugin\EditorPluginInterface

Defines an interface for configurable text editors.

Modules implementing this interface may want to extend the EditorBase class, which provides default implementations of each method where appropriate.

If the editor's behavior depends on extensive options and/or external data, then the implementing module can choose to provide a separate, global configuration page rather than per-text-format settings. In that case, this form should provide a link to the separate settings page.

Hierarchy

Expanded class hierarchy of EditorPluginInterface

All classes that implement EditorPluginInterface

See also

\Drupal\editor\Annotation\Editor

\Drupal\editor\Plugin\EditorBase

\Drupal\editor\Plugin\EditorManager

Plugin API

1 string reference to 'EditorPluginInterface'
editor.schema.yml in core/modules/editor/config/schema/editor.schema.yml
core/modules/editor/config/schema/editor.schema.yml

File

core/modules/editor/src/Plugin/EditorPluginInterface.php, line 25

Namespace

Drupal\editor\Plugin
View source
interface EditorPluginInterface extends PluginInspectionInterface, PluginFormInterface {
    
    /**
     * Returns the default settings for this configurable text editor.
     *
     * @return array
     *   An array of settings as they would be stored by a configured text editor
     *   entity (\Drupal\editor\Entity\Editor).
     */
    public function getDefaultSettings();
    
    /**
     * Returns JavaScript settings to be attached.
     *
     * Most text editors use JavaScript to provide a WYSIWYG or toolbar on the
     * client-side interface. This method can be used to convert internal settings
     * of the text editor into JavaScript variables that will be accessible when
     * the text editor is loaded.
     *
     * @param \Drupal\editor\Entity\Editor $editor
     *   A configured text editor object.
     *
     * @return array
     *   An array of settings that will be added to the page for use by this text
     *   editor's JavaScript integration.
     *
     * @see \Drupal\Core\Render\AttachmentsResponseProcessorInterface::processAttachments()
     * @see EditorManager::getAttachments()
     */
    public function getJSSettings(Editor $editor);
    
    /**
     * 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.
     *
     * @param \Drupal\editor\Entity\Editor $editor
     *   A configured text editor object.
     *
     * @return array
     *   An array of libraries that will be added to the page for use by this text
     *   editor.
     *
     * @see \Drupal\Core\Render\AttachmentsResponseProcessorInterface::processAttachments()
     * @see EditorManager::getAttachments()
     */
    public function getLibraries(Editor $editor);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
EditorPluginInterface::getDefaultSettings public function Returns the default settings for this configurable text editor. 1
EditorPluginInterface::getJSSettings public function Returns JavaScript settings to be attached. 3
EditorPluginInterface::getLibraries public function Returns libraries to be attached. 3
PluginFormInterface::buildConfigurationForm public function Form constructor. 31
PluginFormInterface::submitConfigurationForm public function Form submission handler. 29
PluginFormInterface::validateConfigurationForm public function Form validation handler. 16
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.