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

See also

\Drupal\editor\Plugin\EditorPluginInterface

\Drupal\editor\Plugin\EditorBase

\Drupal\editor\Plugin\EditorManager

hook_editor_info_alter()

Plugin API

Related topics

Annotations
Annotations for class discovery and metadata description.

File

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

Namespace

Drupal\editor\Annotation

Members

Name Modifiers Type Description
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.
Plugin::get public function Gets the value of an annotation. Overrides AnnotationInterface::get
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
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.
doc_Drupal
2016-10-29 09:03:35
Comments
Leave a Comment

Please login to continue.