Issue #1862344 by damiankloip, tim.plunkett: Combine the Views plugin managers.
parent
206598cc42
commit
c783542c40
|
@ -2,10 +2,10 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\views\Plugin\Type\DefaultWizardDeriver.
|
||||
* Contains \Drupal\views\Plugin\Derivative\DefaultWizardDeriver.
|
||||
*/
|
||||
|
||||
namespace Drupal\views\Plugin\Type;
|
||||
namespace Drupal\views\Plugin\Derivative;
|
||||
|
||||
use Drupal\Component\Plugin\Derivative\DerivativeInterface;
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\views\Plugin\Type\JoinManager.
|
||||
*/
|
||||
|
||||
namespace Drupal\views\Plugin\Type;
|
||||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Component\Plugin\Discovery\ProcessDecorator;
|
||||
use Drupal\Core\Plugin\Discovery\AlterDecorator;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
use Drupal\Core\Plugin\Discovery\CacheDecorator;
|
||||
|
||||
class JoinManager extends PluginManagerBase {
|
||||
|
||||
/**
|
||||
* Constructs a JoinManager object.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'join');
|
||||
$this->discovery = new AlterDecorator($this->discovery, 'views_plugins_join');
|
||||
$this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));
|
||||
$this->discovery = new CacheDecorator($this->discovery, 'views:join', 'views_info');
|
||||
|
||||
$this->factory = new DefaultFactory($this);
|
||||
$this->defaults = array(
|
||||
'module' => 'views',
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\views\Plugin\Type\WizardManager.
|
||||
*/
|
||||
|
||||
namespace Drupal\views\Plugin\Type;
|
||||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator;
|
||||
use Drupal\Component\Plugin\Discovery\ProcessDecorator;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Core\Plugin\Discovery\AlterDecorator;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
use Drupal\Core\Plugin\Discovery\CacheDecorator;
|
||||
|
||||
class WizardManager extends PluginManagerBase {
|
||||
|
||||
/**
|
||||
* Constructs a WizardManager object.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'wizard');
|
||||
$this->discovery = new AlterDecorator($this->discovery, 'views_plugins_wizard');
|
||||
$this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));
|
||||
$this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
|
||||
$this->discovery = new CacheDecorator($this->discovery, 'views:wizard', 'views_info');
|
||||
$this->factory = new DefaultFactory($this);
|
||||
$this->defaults = array(
|
||||
'module' => 'views',
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -2,30 +2,36 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\views\Plugin\Type\PluginManager.
|
||||
* Contains \Drupal\views\Plugin\ViewsPluginManager.
|
||||
*/
|
||||
|
||||
namespace Drupal\views\Plugin\Type;
|
||||
namespace Drupal\views\Plugin;
|
||||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Component\Plugin\Discovery\ProcessDecorator;
|
||||
use Drupal\Core\Plugin\Discovery\AlterDecorator;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
use Drupal\Core\Plugin\Discovery\CacheDecorator;
|
||||
|
||||
class PluginManager extends PluginManagerBase {
|
||||
/**
|
||||
* Plugin type manager for all views plugins.
|
||||
*/
|
||||
class ViewsPluginManager extends PluginManagerBase {
|
||||
|
||||
/**
|
||||
* Constructs a PluginManager object.
|
||||
* Constructs a ViewsPluginManager object.
|
||||
*/
|
||||
public function __construct($type) {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', $type);
|
||||
$this->discovery = new AlterDecorator($this->discovery, 'views_plugins_' . $type);
|
||||
$this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
|
||||
$this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));
|
||||
$this->discovery = new AlterDecorator($this->discovery, 'views_plugins_' . $type);
|
||||
$this->discovery = new CacheDecorator($this->discovery, 'views:' . $type, 'views_info');
|
||||
|
||||
$this->factory = new DefaultFactory($this);
|
||||
|
||||
$this->defaults += array(
|
||||
'parent' => 'parent',
|
||||
'plugin_type' => $type,
|
|
@ -12,7 +12,7 @@ use Drupal\Core\Annotation\Plugin;
|
|||
/**
|
||||
* @Plugin(
|
||||
* id = "standard",
|
||||
* derivative = "Drupal\views\Plugin\Type\DefaultWizardDeriver"
|
||||
* derivative = "Drupal\views\Plugin\Derivative\DefaultWizardDeriver"
|
||||
* )
|
||||
*/
|
||||
class Standard extends WizardPluginBase {
|
||||
|
|
|
@ -21,17 +21,9 @@ class ViewsBundle extends Bundle {
|
|||
*/
|
||||
public function build(ContainerBuilder $container) {
|
||||
foreach (ViewExecutable::getPluginTypes() as $type) {
|
||||
if ($type == 'join') {
|
||||
$container->register('plugin.manager.views.join', 'Drupal\views\Plugin\Type\JoinManager');
|
||||
}
|
||||
elseif ($type == 'wizard') {
|
||||
$container->register('plugin.manager.views.wizard', 'Drupal\views\Plugin\Type\WizardManager');
|
||||
}
|
||||
else {
|
||||
$container->register("plugin.manager.views.$type", 'Drupal\views\Plugin\Type\PluginManager')
|
||||
$container->register("plugin.manager.views.$type", 'Drupal\views\Plugin\ViewsPluginManager')
|
||||
->addArgument($type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue