Issue #1987298 by tim.plunkett, quicksketch: Shorten directory structure and PSR-0 namespacing for plugins.

8.0.x
Alex Pott 2013-05-07 21:34:00 +01:00
parent a57952c6a4
commit 19e6c2c0ae
68 changed files with 117 additions and 121 deletions

View File

@ -25,7 +25,7 @@ class ArchiverManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('Core', 'Archiver', $namespaces);
$this->discovery = new AnnotatedClassDiscovery('Archiver', $namespaces);
$this->discovery = new AlterDecorator($this->discovery, 'archiver_info');
$this->discovery = new CacheDecorator($this->discovery, 'archiver_info');
}

View File

@ -29,7 +29,7 @@ class ConditionManager extends PluginManagerBase implements ExecutableManagerInt
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('Core', 'Condition', $namespaces);
$this->discovery = new AnnotatedClassDiscovery('Condition', $namespaces);
$this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
$this->discovery = new AlterDecorator($this->discovery, 'condition_info');
$this->discovery = new CacheDecorator($this->discovery, 'condition:' . language(LANGUAGE_TYPE_INTERFACE)->langcode);

View File

@ -50,7 +50,7 @@ class EntityManager extends PluginManagerBase {
$annotation_namespaces = array(
'Drupal\Core\Entity\Annotation' => DRUPAL_ROOT . '/core/lib',
);
$this->discovery = new AnnotatedClassDiscovery('Core', 'Entity', $namespaces, $annotation_namespaces, 'Drupal\Core\Entity\Annotation\EntityType');
$this->discovery = new AnnotatedClassDiscovery('Core/Entity', $namespaces, $annotation_namespaces, 'Drupal\Core\Entity\Annotation\EntityType');
$this->discovery = new InfoHookDecorator($this->discovery, 'entity_info');
$this->discovery = new AlterDecorator($this->discovery, 'entity_info');
$this->discovery = new CacheDecorator($this->discovery, 'entity_info:' . language(LANGUAGE_TYPE_INTERFACE)->langcode, 'cache', CacheBackendInterface::CACHE_PERMANENT, array('entity_info' => TRUE));

View File

@ -38,14 +38,12 @@ class AnnotatedClassDiscovery extends ComponentAnnotatedClassDiscovery {
/**
* Constructs an AnnotatedClassDiscovery object.
*
* @param string $owner
* The module name that defines the plugin type.
* @param string $type
* The plugin type, for example filter.
* @param string $subdir
* The plugin's subdirectory, for example views/filter.
* @param \Traversable $root_namespaces
* An object that implements \Traversable which contains the root paths
* keyed by the corresponding namespace to look for plugin implementations,
* \Plugin\$owner\$type will be appended to each namespace.
* \Plugin\$subdir will be appended to each namespace.
* @param array $annotation_namespaces
* (optional) The namespaces of classes that can be used as annotations.
* Defaults to an empty array.
@ -53,9 +51,8 @@ class AnnotatedClassDiscovery extends ComponentAnnotatedClassDiscovery {
* (optional) The name of the annotation that contains the plugin definition.
* Defaults to 'Drupal\Component\Annotation\Plugin'.
*/
function __construct($owner, $type, \Traversable $root_namespaces, $annotation_namespaces = array(), $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin') {
$this->owner = $owner;
$this->type = $type;
function __construct($subdir, \Traversable $root_namespaces, $annotation_namespaces = array(), $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin') {
$this->subdir = str_replace('/', '\\', $subdir);
$this->rootNamespacesIterator = $root_namespaces;
$annotation_namespaces += array(
'Drupal\Component\Annotation' => DRUPAL_ROOT . '/core/lib',
@ -71,7 +68,7 @@ class AnnotatedClassDiscovery extends ComponentAnnotatedClassDiscovery {
protected function getPluginNamespaces() {
$plugin_namespaces = array();
foreach ($this->rootNamespacesIterator as $namespace => $dir) {
$plugin_namespaces["$namespace\\Plugin\\{$this->owner}\\{$this->type}"] = array($dir);
$plugin_namespaces["$namespace\\Plugin\\{$this->subdir}"] = array($dir);
}
return $plugin_namespaces;

View File

@ -44,7 +44,7 @@ class ConstraintManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('Validation', 'Constraint', $namespaces);
$this->discovery = new AnnotatedClassDiscovery('Validation/Constraint', $namespaces);
$this->discovery = new StaticDiscoveryDecorator($this->discovery, array($this, 'registerDefinitions'));
$this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
$this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));

View File

@ -27,7 +27,7 @@ class AggregatorPluginManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct($type, \Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('aggregator', $type, $namespaces);
$this->discovery = new AnnotatedClassDiscovery("aggregator/$type", $namespaces);
$this->discovery = new CacheDecorator($this->discovery, "aggregator_$type:" . language(LANGUAGE_TYPE_INTERFACE)->langcode);
$this->factory = new DefaultFactory($this->discovery);
}

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\aggregator\Plugin\block\block\AggregatorCategoryBlock.
* Contains \Drupal\aggregator\Plugin\Block\AggregatorCategoryBlock.
*/
namespace Drupal\aggregator\Plugin\block\block;
namespace Drupal\aggregator\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\aggregator\Plugin\block\block\AggregatorFeedBlock.
* Contains \Drupal\aggregator\Plugin\Block\AggregatorFeedBlock.
*/
namespace Drupal\aggregator\Plugin\block\block;
namespace Drupal\aggregator\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -7,7 +7,6 @@
use Drupal\custom_block\Plugin\Core\Entity\CustomBlockType;
use Drupal\custom_block\Plugin\Core\Entity\CustomBlock;
use Drupal\custom_block\Plugin\block\block\CustomBlockBlock;
use Drupal\block\Plugin\Core\Entity\Block;
/**

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\custom_block\Plugin\block\block\CustomBlockBlock.
* Contains \Drupal\custom_block\Plugin\Block\CustomBlockBlock.
*/
namespace Drupal\custom_block\Plugin\block\block;
namespace Drupal\custom_block\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -1,10 +1,10 @@
<?php
/**
* Contains \Drupal\block\Plugin\system\plugin_ui\BlockPluginUI.
* Contains \Drupal\block\Plugin\PluginUI\BlockPluginUI.
*/
namespace Drupal\block\Plugin\system\plugin_ui;
namespace Drupal\block\Plugin\PluginUI;
use Drupal\system\Plugin\PluginUIBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -32,7 +32,7 @@ class BlockManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('block', 'block', $namespaces);
$this->discovery = new AnnotatedClassDiscovery('Block', $namespaces);
$this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
$this->discovery = new AlterDecorator($this->discovery, 'block');
$this->discovery = new CacheDecorator($this->discovery, 'block_plugins:' . language(LANGUAGE_TYPE_INTERFACE)->langcode, 'block', CacheBackendInterface::CACHE_PERMANENT, array('block'));

View File

@ -8,7 +8,7 @@
namespace Drupal\block\Tests;
use Drupal\simpletest\DrupalUnitTestBase;
use Drupal\block_test\Plugin\block\block\TestHtmlIdBlock;
use Drupal\block_test\Plugin\Block\TestHtmlIdBlock;
use Drupal\Component\Plugin\Exception\PluginException;
use Drupal\block\BlockStorageController;
use Drupal\Core\Entity\EntityMalformedException;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\block_test\Plugin\block\block\TestCacheBlock.
* Contains \Drupal\block_test\Plugin\Block\TestCacheBlock.
*/
namespace Drupal\block_test\Plugin\block\block;
namespace Drupal\block_test\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\block_test\Plugin\block\block\TestHtmlIdBlock.
* Contains \Drupal\block_test\Plugin\Block\TestHtmlIdBlock.
*/
namespace Drupal\block_test\Plugin\block\block;
namespace Drupal\block_test\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\block_test\Plugin\block\block\TestXSSTitleBlock.
* Contains \Drupal\block_test\Plugin\Block\TestXSSTitleBlock.
*/
namespace Drupal\block_test\Plugin\block\block;
namespace Drupal\block_test\Plugin\Block;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\book\Plugin\block\block\BookNavigationBlock.
* Contains \Drupal\book\Plugin\Block\BookNavigationBlock.
*/
namespace Drupal\book\Plugin\block\block;
namespace Drupal\book\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -29,7 +29,7 @@ class CKEditorPluginManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('ckeditor', 'plugin', $namespaces);
$this->discovery = new AnnotatedClassDiscovery('CKEditorPlugin', $namespaces);
$this->discovery = new AlterDecorator($this->discovery, 'ckeditor_plugin_info');
$this->discovery = new CacheDecorator($this->discovery, 'ckeditor_plugin');
$this->factory = new DefaultFactory($this->discovery);

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\ckeditor\Plugin\ckeditor\plugin\Internal.
* Contains \Drupal\ckeditor\Plugin\CKEditorPlugin\Internal.
*/
namespace Drupal\ckeditor\Plugin\ckeditor\plugin;
namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\Component\Utility\NestedArray;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\ckeditor\Plugin\ckeditor\plugin\StylesCombo.
* Contains \Drupal\ckeditor\Plugin\CKEditorPlugin\StylesCombo.
*/
namespace Drupal\ckeditor\Plugin\ckeditor\plugin;
namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\ckeditor\CKEditorPluginConfigurableInterface;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\ckeditor_test\Plugin\ckeditor\plugin\Llama.
* Contains \Drupal\ckeditor_test\Plugin\CKEditorPlugin\Llama.
*/
namespace Drupal\ckeditor_test\Plugin\ckeditor\plugin;
namespace Drupal\ckeditor_test\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginInterface;
use Drupal\Component\Plugin\PluginBase;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\ckeditor_test\Plugin\ckeditor\plugin\LlamaButton.
* Contains \Drupal\ckeditor_test\Plugin\CKEditorPlugin\LlamaButton.
*/
namespace Drupal\ckeditor_test\Plugin\ckeditor\plugin;
namespace Drupal\ckeditor_test\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginButtonsInterface;
use Drupal\Component\Plugin\PluginBase;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\ckeditor_test\Plugin\ckeditor\plugin\LlamaContextual.
* Contains \Drupal\ckeditor_test\Plugin\CKEditorPlugin\LlamaContextual.
*/
namespace Drupal\ckeditor_test\Plugin\ckeditor\plugin;
namespace Drupal\ckeditor_test\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginContextualInterface;
use Drupal\Component\Plugin\PluginBase;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\ckeditor_test\Plugin\ckeditor\plugin\LlamaContextualAndButton.
* Contains \Drupal\ckeditor_test\Plugin\CKEditorPlugin\LlamaContextualAndButton.
*/
namespace Drupal\ckeditor_test\Plugin\ckeditor\plugin;
namespace Drupal\ckeditor_test\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginButtonsInterface;
use Drupal\ckeditor\CKEditorPluginContextualInterface;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\comment\Plugin\block\block\RecentCommentsBlock.
* Contains \Drupal\comment\Plugin\Block\RecentCommentsBlock.
*/
namespace Drupal\comment\Plugin\block\block;
namespace Drupal\comment\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -29,7 +29,7 @@ class EditorManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('edit', 'editor', $namespaces);
$this->discovery = new AnnotatedClassDiscovery('edit/editor', $namespaces);
$this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));
$this->discovery = new AlterDecorator($this->discovery, 'edit_editor');
$this->discovery = new CacheDecorator($this->discovery, 'edit:editor');

View File

@ -27,7 +27,7 @@ class EditorManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('editor', 'editor', $namespaces);
$this->discovery = new AnnotatedClassDiscovery('editor/editor', $namespaces);
$this->discovery = new AlterDecorator($this->discovery, 'editor_info');
$this->discovery = new CacheDecorator($this->discovery, 'editor');
$this->factory = new DefaultFactory($this->discovery);

View File

@ -28,7 +28,7 @@ class SelectionPluginManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->baseDiscovery = new AlterDecorator(new AnnotatedClassDiscovery('entity_reference', 'selection', $namespaces), 'entity_reference_selection');
$this->baseDiscovery = new AlterDecorator(new AnnotatedClassDiscovery('entity_reference/selection', $namespaces), 'entity_reference_selection');
$this->discovery = new CacheDecorator($this->baseDiscovery, 'entity_reference_selection');
$this->factory = new ReflectionFactory($this);
}

View File

@ -35,7 +35,7 @@ class FormatterPluginManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('field', 'formatter', $namespaces);
$this->discovery = new AnnotatedClassDiscovery('field/formatter', $namespaces);
$this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));
$this->discovery = new AlterDecorator($this->discovery, 'field_formatter_info');
$this->discovery = new CacheDecorator($this->discovery, 'field_formatter_types', 'field');

View File

@ -36,7 +36,7 @@ class WidgetPluginManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('field', 'widget', $namespaces);
$this->discovery = new AnnotatedClassDiscovery('field/widget', $namespaces);
$this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));
$this->discovery = new AlterDecorator($this->discovery, 'field_widget_info');
$this->discovery = new CacheDecorator($this->discovery, 'field_widget_types', 'field');

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\forum\Plugin\block\block\ActiveTopicsBlock.
* Contains \Drupal\forum\Plugin\Block\ActiveTopicsBlock.
*/
namespace Drupal\forum\Plugin\block\block;
namespace Drupal\forum\Plugin\Block;
use Drupal\Component\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\forum\Plugin\block\block\ForumBlockBase.
* Contains \Drupal\forum\Plugin\Block\ForumBlockBase.
*/
namespace Drupal\forum\Plugin\block\block;
namespace Drupal\forum\Plugin\Block;
use Drupal\block\BlockBase;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\forum\Plugin\block\block\NewTopicsBlock.
* Contains \Drupal\forum\Plugin\Block\NewTopicsBlock.
*/
namespace Drupal\forum\Plugin\block\block;
namespace Drupal\forum\Plugin\Block;
use Drupal\Component\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\language\Plugin\block\block\LanguageBlock.
* Contains \Drupal\language\Plugin\Block\LanguageBlock.
*/
namespace Drupal\language\Plugin\block\block;
namespace Drupal\language\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\language\Plugin\Core\Condition\Language.
* Contains \Drupal\language\Plugin\Condition\Language.
*/
namespace Drupal\language\Plugin\Core\Condition;
namespace Drupal\language\Plugin\Condition;
use Drupal\Core\Condition\ConditionPluginBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\layout\Plugin\layout\layout\StaticLayout.
* Contains \Drupal\layout\Plugin\Layout\StaticLayout.
*/
namespace Drupal\layout\Plugin\layout\layout;
namespace Drupal\layout\Plugin\Layout;
use Drupal\layout\Plugin\LayoutInterface;
use Drupal\Component\Plugin\PluginBase;

View File

@ -19,7 +19,7 @@ use Drupal\Component\Plugin\Factory\ReflectionFactory;
class LayoutManager extends PluginManagerBase {
protected $defaults = array(
'class' => 'Drupal\layout\Plugin\layout\layout\StaticLayout',
'class' => 'Drupal\layout\Plugin\Layout\StaticLayout',
);
/**
@ -31,7 +31,7 @@ class LayoutManager extends PluginManagerBase {
*/
public function __construct(\Traversable $namespaces) {
// Create layout plugin derivatives from declaratively defined layouts.
$this->discovery = new AnnotatedClassDiscovery('layout', 'layout', $namespaces);
$this->discovery = new AnnotatedClassDiscovery('Layout', $namespaces);
$this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
$this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));

View File

@ -2,12 +2,12 @@
/**
* @file
* Contains \Drupal\menu\Plugin\block\block\MenuBlock.
* Contains \Drupal\menu\Plugin\Block\MenuBlock.
*/
namespace Drupal\menu\Plugin\block\block;
namespace Drupal\menu\Plugin\Block;
use Drupal\system\Plugin\block\block\SystemMenuBlock;
use Drupal\system\Plugin\Block\SystemMenuBlock;
use Drupal\Component\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;

View File

@ -14,7 +14,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\block\Plugin\Core\Entity\Block;
use Drupal\system\Plugin\Core\Entity\Menu;
use Drupal\system\Plugin\block\block\SystemMenuBlock;
use Drupal\system\Plugin\Block\SystemMenuBlock;
use Symfony\Component\HttpFoundation\JsonResponse;
use Drupal\menu_link\Plugin\Core\Entity\MenuLink;
use Drupal\menu_link\MenuLinkStorageController;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\node\Plugin\block\block\RecentContentBlock.
* Contains \Drupal\node\Plugin\Block\RecentContentBlock.
*/
namespace Drupal\node\Plugin\block\block;
namespace Drupal\node\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\node\Plugin\block\block\SyndicateBlock.
* Contains \Drupal\node\Plugin\Block\SyndicateBlock.
*/
namespace Drupal\node\Plugin\block\block;
namespace Drupal\node\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\node\Plugin\Core\Condition\NodeType.
* Contains \Drupal\node\Plugin\Condition\NodeType.
*/
namespace Drupal\node\Plugin\Core\Condition;
namespace Drupal\node\Plugin\Condition;
use Drupal\Core\Condition\ConditionPluginBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\php\Plugin\Core\Condition\Php.
* Contains \Drupal\php\Plugin\Condition\Php.
*/
namespace Drupal\php\Plugin\Core\Condition;
namespace Drupal\php\Plugin\Condition;
use Drupal\Core\Condition\ConditionPluginBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -26,7 +26,7 @@ class ResourcePluginManager extends PluginManagerBase {
*/
public function __construct(\Traversable $namespaces) {
// Create resource plugin derivatives from declaratively defined resources.
$this->discovery = new DerivativeDiscoveryDecorator(new AnnotatedClassDiscovery('rest', 'resource', $namespaces));
$this->discovery = new DerivativeDiscoveryDecorator(new AnnotatedClassDiscovery('rest/resource', $namespaces));
$this->factory = new ReflectionFactory($this->discovery);
}

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\search\Plugin\block\block\SearchBlock.
* Contains \Drupal\search\Plugin\Block\SearchBlock.
*/
namespace Drupal\search\Plugin\block\block;
namespace Drupal\search\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\shortcut\Plugin\block\block\ShortcutsBlock.
* Contains \Drupal\shortcut\Plugin\Block\ShortcutsBlock.
*/
namespace Drupal\shortcut\Plugin\block\block;
namespace Drupal\shortcut\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\statistics\Plugin\block\block\StatisticsPopularBlock.
* Contains \Drupal\statistics\Plugin\Block\StatisticsPopularBlock.
*/
namespace Drupal\statistics\Plugin\block\block;
namespace Drupal\statistics\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -5,7 +5,7 @@
* Contains \Drupal\system\Plugin\Core\Archiver\Tar.
*/
namespace Drupal\system\Plugin\Core\Archiver;
namespace Drupal\system\Plugin\Archiver;
use Drupal\Component\Archiver\Tar as BaseTar;
use Drupal\Component\Annotation\Plugin;

View File

@ -5,7 +5,7 @@
* Contains \Drupal\system\Plugin\Core\Archiver\Zip.
*/
namespace Drupal\system\Plugin\Core\Archiver;
namespace Drupal\system\Plugin\Archiver;
use Drupal\Component\Archiver\Zip as BaseZip;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\system\Plugin\block\block\SystemHelpBlock.
* Contains \Drupal\system\Plugin\Block\SystemHelpBlock.
*/
namespace Drupal\system\Plugin\block\block;
namespace Drupal\system\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\system\Plugin\block\block\SystemMainBlock.
* Contains \Drupal\system\Plugin\Block\SystemMainBlock.
*/
namespace Drupal\system\Plugin\block\block;
namespace Drupal\system\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\system\Plugin\block\block\SystemMenuBlock.
* Contains \Drupal\system\Plugin\Block\SystemMenuBlock.
*/
namespace Drupal\system\Plugin\block\block;
namespace Drupal\system\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\system\Plugin\block\block\SystemPoweredByBlock.
* Contains \Drupal\system\Plugin\Block\SystemPoweredByBlock.
*/
namespace Drupal\system\Plugin\block\block;
namespace Drupal\system\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\system\Plugin\system\imagetoolkit\GDToolkit;.
* Contains \Drupal\system\Plugin\ImageToolkit\GDToolkit;.
*/
namespace Drupal\system\Plugin\system\imagetoolkit;
namespace Drupal\system\Plugin\ImageToolkit;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -24,7 +24,7 @@ class ImageToolkitManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('system', 'imagetoolkit', $namespaces);
$this->discovery = new AnnotatedClassDiscovery('ImageToolkit', $namespaces);
$this->factory = new DefaultFactory($this->discovery);
}

View File

@ -29,7 +29,7 @@ class PluginUIManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('system', 'plugin_ui', $namespaces);
$this->discovery = new AnnotatedClassDiscovery('PluginUI', $namespaces);
$this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
$this->discovery = new AlterDecorator($this->discovery, 'plugin_ui');
$this->discovery = new CacheDecorator($this->discovery, 'plugin_ui');

View File

@ -54,8 +54,8 @@ class AnnotatedClassDiscoveryTest extends DiscoveryTestBase {
),
);
$namespaces = new \ArrayObject(array('Drupal\plugin_test' => DRUPAL_ROOT . '/core/modules/system/tests/modules/plugin_test/lib'));
$this->discovery = new AnnotatedClassDiscovery('plugin_test', 'fruit', $namespaces);
$this->emptyDiscovery = new AnnotatedClassDiscovery('non_existing_module', 'non_existing_plugin_type', $namespaces);
$this->discovery = new AnnotatedClassDiscovery('plugin_test/fruit', $namespaces);
$this->emptyDiscovery = new AnnotatedClassDiscovery('non_existing_module/non_existing_plugin_type', $namespaces);
}
}

View File

@ -44,8 +44,8 @@ class CustomAnnotationClassDiscoveryTest extends DiscoveryTestBase {
'Drupal\plugin_test\Plugin\Annotation' => DRUPAL_ROOT . '/core/modules/system/tests/modules/plugin_test/lib',
);
$this->discovery = new AnnotatedClassDiscovery('plugin_test', 'custom_annotation', $root_namespaces, $annotation_namespaces, 'Drupal\plugin_test\Plugin\Annotation\PluginExample');
$this->emptyDiscovery = new AnnotatedClassDiscovery('non_existing_module', 'non_existing_plugin_type', $root_namespaces, $annotation_namespaces, 'Drupal\plugin_test\Plugin\Annotation\PluginExample');
$this->discovery = new AnnotatedClassDiscovery('plugin_test/custom_annotation', $root_namespaces, $annotation_namespaces, 'Drupal\plugin_test\Plugin\Annotation\PluginExample');
$this->emptyDiscovery = new AnnotatedClassDiscovery('non_existing_module/non_existing_plugin_type', $root_namespaces, $annotation_namespaces, 'Drupal\plugin_test\Plugin\Annotation\PluginExample');
}
}

View File

@ -10,7 +10,7 @@ use Drupal\Core\Cache\Cache;
use Drupal\Core\Database\Database;
use Drupal\Core\Utility\ModuleInfo;
use Drupal\Core\TypedData\Primitive;
use Drupal\system\Plugin\block\block\SystemMenuBlock;
use Drupal\system\Plugin\Block\SystemMenuBlock;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Guzzle\Http\Exception\BadResponseException;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\image_test\Plugin\system\imagetoolkit\BrokenToolkit.
* Contains \Drupal\image_test\Plugin\ImageToolkit\BrokenToolkit.
*/
namespace Drupal\image_test\Plugin\system\imagetoolkit;
namespace Drupal\image_test\Plugin\ImageToolkit;
use Drupal\Component\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\image_test\Plugin\system\imagetoolkit\TestToolkit.
* Contains \Drupal\image_test\Plugin\ImageToolkit\TestToolkit.
*/
namespace Drupal\image_test\Plugin\system\imagetoolkit;
namespace Drupal\image_test\Plugin\ImageToolkit;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -27,7 +27,7 @@ class TipPluginManager extends PluginManagerBase {
*/
public function __construct(\Traversable $namespaces) {
$annotation_namespaces = array('Drupal\tour\Annotation' => $namespaces['Drupal\tour']);
$this->discovery = new AnnotatedClassDiscovery('tour', 'tip', $namespaces, $annotation_namespaces, 'Drupal\tour\Annotation\Tip');
$this->discovery = new AnnotatedClassDiscovery('tour/tip', $namespaces, $annotation_namespaces, 'Drupal\tour\Annotation\Tip');
$this->discovery = new CacheDecorator($this->discovery, 'tour');
$this->factory = new DefaultFactory($this->discovery);

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\user\Plugin\block\block\UserLoginBlock.
* Contains \Drupal\user\Plugin\Block\UserLoginBlock.
*/
namespace Drupal\user\Plugin\block\block;
namespace Drupal\user\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\user\Plugin\block\block\UserNewBlock.
* Contains \Drupal\user\Plugin\Block\UserNewBlock.
*/
namespace Drupal\user\Plugin\block\block;
namespace Drupal\user\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\user\Plugin\block\block\UserOnlineBlock.
* Contains \Drupal\user\Plugin\Block\UserOnlineBlock.
*/
namespace Drupal\user\Plugin\block\block;
namespace Drupal\user\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\Component\Annotation\Plugin;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\views\Plugin\block\block\ViewsBlock.
* Contains \Drupal\views\Plugin\Block\ViewsBlock.
*/
namespace Drupal\views\Plugin\block\block;
namespace Drupal\views\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\block\Plugin\Core\Entity\Block;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\views\Plugin\block\block\ViewsExposedFilterBlock.
* Contains \Drupal\views\Plugin\Block\ViewsExposedFilterBlock.
*/
namespace Drupal\views\Plugin\block\block;
namespace Drupal\views\Plugin\Block;
use Drupal\Component\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;

View File

@ -31,7 +31,7 @@ class ViewsPluginManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct($type, \Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('views', $type, $namespaces);
$this->discovery = new AnnotatedClassDiscovery("views/$type", $namespaces);
$this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
$this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));
$this->discovery = new AlterDecorator($this->discovery, 'views_plugins_' . $type);