class Editor

Same name in this branch
  1. 8.9.x core/modules/editor/src/Entity/Editor.php \Drupal\editor\Entity\Editor
  2. 8.9.x core/modules/editor/src/Plugin/InPlaceEditor/Editor.php \Drupal\editor\Plugin\InPlaceEditor\Editor
Same name in other branches
  1. 9 core/modules/quickedit/src/Plugin/InPlaceEditor/Editor.php \Drupal\quickedit\Plugin\InPlaceEditor\Editor
  2. 9 core/modules/editor/src/Entity/Editor.php \Drupal\editor\Entity\Editor
  3. 9 core/modules/editor/src/Annotation/Editor.php \Drupal\editor\Annotation\Editor
  4. 9 core/modules/editor/src/Plugin/InPlaceEditor/Editor.php \Drupal\editor\Plugin\InPlaceEditor\Editor
  5. 10 core/modules/editor/src/Entity/Editor.php \Drupal\editor\Entity\Editor
  6. 10 core/modules/editor/src/Annotation/Editor.php \Drupal\editor\Annotation\Editor
  7. 11.x core/modules/editor/src/Entity/Editor.php \Drupal\editor\Entity\Editor
  8. 11.x core/modules/editor/src/Annotation/Editor.php \Drupal\editor\Annotation\Editor
  9. 11.x core/modules/editor/src/Attribute/Editor.php \Drupal\editor\Attribute\Editor
  10. 10 core/modules/editor/src/Attribute/Editor.php \Drupal\editor\Attribute\Editor

Defines an Editor annotation object.

Plugin Namespace: Plugin\Editor

Text editor plugin implementations 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.
  • supports_content_filtering: Whether the editor supports "allowed content only" filtering.
  • supports_inline_editing: Whether the editor supports the inline editing provided by the Edit module.
  • is_xss_safe: Whether this text editor is not vulnerable to XSS attacks.
  • supported_element_types: On which form element #types this text editor is capable of working.

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


@Editor(
  id = "myeditor",
  label = @Translation("My Editor"),
  supports_content_filtering = FALSE,
  supports_inline_editing = FALSE,
  is_xss_safe = FALSE,
  supported_element_types = {
    "textarea",
    "textfield",
  }
)

For a working example, see \Drupal\ckeditor\Plugin\Editor\CKEditor

Hierarchy

Expanded class hierarchy of Editor

See also

\Drupal\editor\Plugin\EditorPluginInterface

\Drupal\editor\Plugin\EditorBase

\Drupal\editor\Plugin\EditorManager

hook_editor_info_alter()

Plugin API

Related topics

39 string references to 'Editor'
CKEditor::buildConfigurationForm in core/modules/ckeditor/src/Plugin/Editor/CKEditor.php
Form constructor.
ContentTranslationTestBase::setupUsers in core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php
Creates and activates translator, editor and admin users.
ContentTranslationTestBase::setupUsers in core/modules/content_translation/src/Tests/ContentTranslationTestBase.php
Creates and activates translator, editor and admin users.
demo_umami.info.yml in core/profiles/demo_umami/demo_umami.info.yml
core/profiles/demo_umami/demo_umami.info.yml
DrupalImage::settingsForm in core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImage.php

... See full list

3 classes are annotated with Editor
CKEditor in core/modules/ckeditor/src/Plugin/Editor/CKEditor.php
Defines a CKEditor-based text editor for Drupal.
TRexEditor in core/modules/editor/tests/modules/src/Plugin/Editor/TRexEditor.php
Defines a Tyrannosaurus-Rex powered text editor for testing purposes.
UnicornEditor in core/modules/editor/tests/modules/src/Plugin/Editor/UnicornEditor.php
Defines a Unicorn-powered text editor for Drupal (for testing purposes).

File

core/modules/editor/src/Annotation/Editor.php, line 53

Namespace

Drupal\editor\Annotation
View source
class Editor extends Plugin {
    
    /**
     * The plugin ID.
     *
     * @var string
     */
    public $id;
    
    /**
     * The human-readable name of the editor plugin.
     *
     * @ingroup plugin_translatable
     *
     * @var \Drupal\Core\Annotation\Translation
     */
    public $label;
    
    /**
     * Whether the editor supports "allowed content only" filtering.
     *
     * @var bool
     */
    public $supports_content_filtering;
    
    /**
     * Whether the editor supports the inline editing provided by the Edit module.
     *
     * @var bool
     */
    public $supports_inline_editing;
    
    /**
     * Whether this text editor is not vulnerable to XSS attacks.
     *
     * @var bool
     */
    public $is_xss_safe;
    
    /**
     * A list of element types this text editor supports.
     *
     * @var string[]
     */
    public $supported_element_types;

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
Editor::$id public property The plugin ID.
Editor::$is_xss_safe public property Whether this text editor is not vulnerable to XSS attacks.
Editor::$label public property The human-readable name of the editor plugin.
Editor::$supported_element_types public property A list of element types this text editor supports.
Editor::$supports_content_filtering public property Whether the editor supports "allowed content only" filtering.
Editor::$supports_inline_editing public property Whether the editor supports the inline editing provided by the Edit module.
Plugin::$definition protected property The plugin definition read from the class annotation. 1
Plugin::get public function Gets the value of an annotation. Overrides AnnotationInterface::get 5
Plugin::getClass public function Gets the class of the annotated class. Overrides AnnotationInterface::getClass
Plugin::getId public function Gets the unique ID for this annotated class. Overrides AnnotationInterface::getId
Plugin::getProvider public function Gets the name of the provider of the annotated class. Overrides AnnotationInterface::getProvider 1
Plugin::parse protected function Parses an annotation into its definition.
Plugin::setClass public function Sets the class of the annotated class. Overrides AnnotationInterface::setClass
Plugin::setProvider public function Sets the name of the provider of the annotated class. Overrides AnnotationInterface::setProvider
Plugin::__construct public function Constructs a Plugin object. 2

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