Commit 25ad0ea4 authored by webchick's avatar webchick

Issue #1875098 by tim.plunkett: Fixed Edit's processed text editor plugins bleed into test runs

parent a82e9ea9
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\PluginManagerBase;
use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Component\Plugin\Factory\DefaultFactory;
use Drupal\Component\Plugin\Discovery\ProcessDecorator;
use Drupal\Core\Plugin\Discovery\AlterDecorator; use Drupal\Core\Plugin\Discovery\AlterDecorator;
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
use Drupal\Core\Plugin\Discovery\CacheDecorator; use Drupal\Core\Plugin\Discovery\CacheDecorator;
...@@ -23,9 +24,23 @@ class ProcessedTextEditorManager extends PluginManagerBase { ...@@ -23,9 +24,23 @@ class ProcessedTextEditorManager extends PluginManagerBase {
*/ */
public function __construct() { public function __construct() {
$this->discovery = new AnnotatedClassDiscovery('edit', 'processed_text_editor'); $this->discovery = new AnnotatedClassDiscovery('edit', 'processed_text_editor');
$this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));
$this->discovery = new AlterDecorator($this->discovery, 'edit_wysiwyg'); $this->discovery = new AlterDecorator($this->discovery, 'edit_wysiwyg');
$this->discovery = new CacheDecorator($this->discovery, 'edit:wysiwyg'); $this->discovery = new CacheDecorator($this->discovery, 'edit:wysiwyg');
$this->factory = new DefaultFactory($this->discovery); $this->factory = new DefaultFactory($this->discovery);
} }
/**
* Overrides Drupal\Component\Plugin\PluginManagerBase::processDefinition().
*/
public function processDefinition(&$definition, $plugin_id) {
parent::processDefinition($definition, $plugin_id);
// @todo Remove this check once http://drupal.org/node/1780396 is resolved.
if (!module_exists($definition['module'])) {
$definition = NULL;
return;
}
}
} }
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
* *
* @Plugin( * @Plugin(
* id = "test_processed_editor", * id = "test_processed_editor",
* title = @Translation("Test Processed Editor") * title = @Translation("Test Processed Editor"),
* module = "edit_test"
* ) * )
*/ */
class TestProcessedEditor extends ProcessedTextEditorBase { class TestProcessedEditor extends ProcessedTextEditorBase {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment