Skip to content
Snippets Groups Projects
Commit 9b6caf53 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #1986988 by tim.plunkett: Add a dedicated @CKEditorPlugin annotation.

parent f140bcee
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Showing with 56 additions and 13 deletions
<?php
/**
* @file
* Contains Drupal\ckeditor\Annotation\CKEditorPlugin.
*/
namespace Drupal\ckeditor\Annotation;
use Drupal\Component\Annotation\Plugin;
/**
* Defines a CKEditorPlugin annotation object.
*
* @Annotation
*/
class CKEditorPlugin extends Plugin {
/**
* The plugin ID.
*
* @var string
*/
public $id;
/**
* The human-readable name of the CKEditor plugin.
*
* @ingroup plugin_translatable
*
* @var \Drupal\Core\Annotation\Translation
*/
public $label;
/**
* The name of the module providing the CKEditor plugin.
*
* @var string
*/
public $module;
}
...@@ -29,7 +29,8 @@ class CKEditorPluginManager extends PluginManagerBase { ...@@ -29,7 +29,8 @@ class CKEditorPluginManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations, * keyed by the corresponding namespace to look for plugin implementations,
*/ */
public function __construct(\Traversable $namespaces) { public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('CKEditorPlugin', $namespaces); $annotation_namespaces = array('Drupal\ckeditor\Annotation' => $namespaces['Drupal\ckeditor']);
$this->discovery = new AnnotatedClassDiscovery('CKEditorPlugin', $namespaces, $annotation_namespaces, 'Drupal\ckeditor\Annotation\CKEditorPlugin');
$this->discovery = new AlterDecorator($this->discovery, 'ckeditor_plugin_info'); $this->discovery = new AlterDecorator($this->discovery, 'ckeditor_plugin_info');
$this->discovery = new CacheDecorator($this->discovery, 'ckeditor_plugin'); $this->discovery = new CacheDecorator($this->discovery, 'ckeditor_plugin');
$this->factory = new DefaultFactory($this->discovery); $this->factory = new DefaultFactory($this->discovery);
......
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
use Drupal\ckeditor\CKEditorPluginBase; use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\Component\Utility\NestedArray; use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Annotation\Plugin; use Drupal\ckeditor\Annotation\CKEditorPlugin;
use Drupal\Core\Annotation\Translation; use Drupal\Core\Annotation\Translation;
use Drupal\editor\Plugin\Core\Entity\Editor; use Drupal\editor\Plugin\Core\Entity\Editor;
/** /**
* Defines the "internal" plugin (i.e. core plugins part of our CKEditor build). * Defines the "internal" plugin (i.e. core plugins part of our CKEditor build).
* *
* @Plugin( * @CKEditorPlugin(
* id = "internal", * id = "internal",
* label = @Translation("CKEditor core"), * label = @Translation("CKEditor core"),
* module = "ckeditor" * module = "ckeditor"
......
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
use Drupal\ckeditor\CKEditorPluginBase; use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\ckeditor\CKEditorPluginConfigurableInterface; use Drupal\ckeditor\CKEditorPluginConfigurableInterface;
use Drupal\Component\Utility\NestedArray; use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Annotation\Plugin; use Drupal\ckeditor\Annotation\CKEditorPlugin;
use Drupal\Core\Annotation\Translation; use Drupal\Core\Annotation\Translation;
use Drupal\editor\Plugin\Core\Entity\Editor; use Drupal\editor\Plugin\Core\Entity\Editor;
/** /**
* Defines the "stylescombo" plugin. * Defines the "stylescombo" plugin.
* *
* @Plugin( * @CKEditorPlugin(
* id = "stylescombo", * id = "stylescombo",
* label = @Translation("Styles dropdown"), * label = @Translation("Styles dropdown"),
* module = "ckeditor" * module = "ckeditor"
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
use Drupal\ckeditor\CKEditorPluginInterface; use Drupal\ckeditor\CKEditorPluginInterface;
use Drupal\Component\Plugin\PluginBase; use Drupal\Component\Plugin\PluginBase;
use Drupal\Component\Annotation\Plugin; use Drupal\ckeditor\Annotation\CKEditorPlugin;
use Drupal\Core\Annotation\Translation; use Drupal\Core\Annotation\Translation;
use Drupal\editor\Plugin\Core\Entity\Editor; use Drupal\editor\Plugin\Core\Entity\Editor;
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* @see MetaButton * @see MetaButton
* @see MetaContextualAndButton * @see MetaContextualAndButton
* *
* @Plugin( * @CKEditorPlugin(
* id = "llama", * id = "llama",
* label = @Translation("Llama"), * label = @Translation("Llama"),
* module = "ckeditor_test" * module = "ckeditor_test"
......
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
use Drupal\ckeditor\CKEditorPluginButtonsInterface; use Drupal\ckeditor\CKEditorPluginButtonsInterface;
use Drupal\Component\Plugin\PluginBase; use Drupal\Component\Plugin\PluginBase;
use Drupal\Component\Annotation\Plugin; use Drupal\ckeditor\Annotation\CKEditorPlugin;
use Drupal\Core\Annotation\Translation; use Drupal\Core\Annotation\Translation;
/** /**
* Defines a "LlamaButton" plugin, with a toolbar builder-enabled "llama" feature. * Defines a "LlamaButton" plugin, with a toolbar builder-enabled "llama" feature.
* *
* @Plugin( * @CKEditorPlugin(
* id = "llama_button", * id = "llama_button",
* label = @Translation("Llama Button"), * label = @Translation("Llama Button"),
* module = "ckeditor_test" * module = "ckeditor_test"
......
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
use Drupal\ckeditor\CKEditorPluginContextualInterface; use Drupal\ckeditor\CKEditorPluginContextualInterface;
use Drupal\Component\Plugin\PluginBase; use Drupal\Component\Plugin\PluginBase;
use Drupal\Component\Annotation\Plugin; use Drupal\ckeditor\Annotation\CKEditorPlugin;
use Drupal\Core\Annotation\Translation; use Drupal\Core\Annotation\Translation;
use Drupal\editor\Plugin\Core\Entity\Editor; use Drupal\editor\Plugin\Core\Entity\Editor;
/** /**
* Defines a "Llama" plugin, with a contextually enabled "llama" feature. * Defines a "Llama" plugin, with a contextually enabled "llama" feature.
* *
* @Plugin( * @CKEditorPlugin(
* id = "llama_contextual", * id = "llama_contextual",
* label = @Translation("Contextual Llama"), * label = @Translation("Contextual Llama"),
* module = "ckeditor_test" * module = "ckeditor_test"
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
use Drupal\ckeditor\CKEditorPluginContextualInterface; use Drupal\ckeditor\CKEditorPluginContextualInterface;
use Drupal\ckeditor\CKEditorPluginConfigurableInterface; use Drupal\ckeditor\CKEditorPluginConfigurableInterface;
use Drupal\Component\Plugin\PluginBase; use Drupal\Component\Plugin\PluginBase;
use Drupal\Component\Annotation\Plugin; use Drupal\ckeditor\Annotation\CKEditorPlugin;
use Drupal\Core\Annotation\Translation; use Drupal\Core\Annotation\Translation;
use Drupal\editor\Plugin\Core\Entity\Editor; use Drupal\editor\Plugin\Core\Entity\Editor;
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* Defines a "LlamaContextualAndbutton" plugin, with a contextually OR toolbar * Defines a "LlamaContextualAndbutton" plugin, with a contextually OR toolbar
* builder-enabled "llama" feature. * builder-enabled "llama" feature.
* *
* @Plugin( * @CKEditorPlugin(
* id = "llama_contextual_and_button", * id = "llama_contextual_and_button",
* label = @Translation("Contextual Llama With Button"), * label = @Translation("Contextual Llama With Button"),
* module = "ckeditor_test" * module = "ckeditor_test"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment