abstract class EditorBase

Defines a base class from which other modules providing editors may extend.

This class provides default implementations of the EditPluginInterface so that classes extending this one do not need to implement every method.

Plugins extending this class need to define a plugin definition array through annotation. These definition arrays may be altered through hook_editor_info_alter(). The definition includes the following keys:

  • id: The unique, system-wide identifier of the text editor. Typically named the same as the editor library.
  • label: The human-readable name of the text editor, translated.
  • module: The name of the module providing the plugin.

A complete sample plugin definition should be defined as in this example:


@Editor(
  id = "myeditor",
  label = @Translation("My Editor")
)

Hierarchy

Expanded class hierarchy of EditorBase

2 files declare their use of EditorBase
CKEditor.php in drupal/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
Contains \Drupal\ckeditor\Plugin\Editor\CKEditor.
UnicornEditor.php in drupal/core/modules/editor/tests/modules/lib/Drupal/editor_test/Plugin/Editor/UnicornEditor.php
Contains \Drupal\editor_test\Plugin\Editor\UnicornEditor.

File

drupal/core/modules/editor/lib/Drupal/editor/Plugin/EditorBase.php, line 38
Contains \Drupal\editor\Plugin\EditorBase.

Namespace

Drupal\editor\Plugin
View source
abstract class EditorBase extends PluginBase implements EditorPluginInterface {

  /**
   * Implements \Drupal\editor\Plugin\EditPluginInterface::getDefaultSettings().
   */
  public function getDefaultSettings() {
    return array();
  }

  /**
   * Implements \Drupal\editor\Plugin\EditPluginInterface::settingsForm().
   */
  public function settingsForm(array $form, array &$form_state, Editor $editor) {
    return $form;
  }

  /**
   * Implements \Drupal\editor\Plugin\EditPluginInterface::settingsFormValidate().
   */
  public function settingsFormValidate(array $form, array &$form_state) {
  }

  /**
   * Implements \Drupal\editor\Plugin\EditPluginInterface::settingsFormSubmit().
   */
  public function settingsFormSubmit(array $form, array &$form_state) {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EditorBase::getDefaultSettings public function Implements \Drupal\editor\Plugin\EditPluginInterface::getDefaultSettings(). Overrides EditorPluginInterface::getDefaultSettings 2
EditorBase::settingsForm public function Implements \Drupal\editor\Plugin\EditPluginInterface::settingsForm(). Overrides EditorPluginInterface::settingsForm 2
EditorBase::settingsFormSubmit public function Implements \Drupal\editor\Plugin\EditPluginInterface::settingsFormSubmit(). Overrides EditorPluginInterface::settingsFormSubmit 1
EditorBase::settingsFormValidate public function Implements \Drupal\editor\Plugin\EditPluginInterface::settingsFormValidate(). Overrides EditorPluginInterface::settingsFormValidate
EditorPluginInterface::getJSSettings function Returns JavaScript settings to be attached. 2
EditorPluginInterface::getLibraries function Returns libraries to be attached. 2
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition.
PluginBase::$pluginId protected property The plugin_id.
PluginBase::getPluginDefinition public function Returns the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition
PluginBase::getPluginId public function Returns the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::__construct public function Constructs a Drupal\Component\Plugin\PluginBase object. 17