From da81cd22065bdda319fae9c4fdd32e232aaef165 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 17 Nov 2015 15:53:49 +0000 Subject: [PATCH] Issue #2617224 by Wim Leers: Move around/fix some documentation --- core/modules/editor/src/Annotation/Editor.php | 32 +++++++++++++++++++ core/modules/editor/src/EditorController.php | 3 ++ core/modules/editor/src/Plugin/EditorBase.php | 26 ++------------- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/core/modules/editor/src/Annotation/Editor.php b/core/modules/editor/src/Annotation/Editor.php index 58d2450c115..e0b28059cd5 100644 --- a/core/modules/editor/src/Annotation/Editor.php +++ b/core/modules/editor/src/Annotation/Editor.php @@ -14,11 +14,43 @@ use Drupal\Component\Annotation\Plugin; * * 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: + * + * @code + * @Editor( + * id = "myeditor", + * label = @Translation("My Editor"), + * supports_content_filtering = FALSE, + * supports_inline_editing = FALSE, + * is_xss_safe = FALSE, + * supported_element_types = { + * "textarea", + * "textfield", + * } + * ) + * @endcode + * * For a working example, see \Drupal\ckeditor\Plugin\Editor\CKEditor * * @see \Drupal\editor\Plugin\EditorPluginInterface * @see \Drupal\editor\Plugin\EditorBase * @see \Drupal\editor\Plugin\EditorManager + * @see hook_editor_info_alter() * @see plugin_api * * @Annotation diff --git a/core/modules/editor/src/EditorController.php b/core/modules/editor/src/EditorController.php index fd605cd7853..73d5dad0eda 100644 --- a/core/modules/editor/src/EditorController.php +++ b/core/modules/editor/src/EditorController.php @@ -60,6 +60,9 @@ class EditorController extends ControllerBase { * @return \Symfony\Component\HttpFoundation\JsonResponse * A JSON response containing the XSS-filtered value. * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + * Thrown if no value to filter is specified. + * * @see editor_filter_xss() */ public function filterXss(Request $request, FilterFormatInterface $filter_format) { diff --git a/core/modules/editor/src/Plugin/EditorBase.php b/core/modules/editor/src/Plugin/EditorBase.php index cc39c18a4ff..514a32cd469 100644 --- a/core/modules/editor/src/Plugin/EditorBase.php +++ b/core/modules/editor/src/Plugin/EditorBase.php @@ -17,30 +17,8 @@ use Drupal\editor\Entity\Editor; * This class provides default implementations of the EditorPluginInterface 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. - * - 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. - * - * A complete sample plugin definition should be defined as in this example: - * - * @code - * @Editor( - * id = "myeditor", - * label = @Translation("My Editor"), - * supports_content_filtering = FALSE, - * supports_inline_editing = FALSE, - * is_xss_safe = FALSE - * ) - * @endcode + * Plugins extending this class need to specify an annotation containing the + * plugin definition so the plugin can be discovered. * * @see \Drupal\editor\Annotation\Editor * @see \Drupal\editor\Plugin\EditorPluginInterface