diff --git a/core/modules/field/field.services.yml b/core/modules/field/field.services.yml index a544de8..ebf9019 100644 --- a/core/modules/field/field.services.yml +++ b/core/modules/field/field.services.yml @@ -1,7 +1,7 @@ services: plugin.manager.field.field_type: class: Drupal\field\Plugin\Type\FieldType\ConfigFieldTypePluginManager - arguments: ['@container.namespaces', '@module_handler'] + arguments: ['@container.namespaces', '@cache.field', '@language_manager', '@module_handler'] plugin.manager.field.widget: class: Drupal\field\Plugin\Type\Widget\WidgetPluginManager arguments: ['@container.namespaces'] diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigFieldTypePluginManager.php b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigFieldTypePluginManager.php index b8ff572..ee39747 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigFieldTypePluginManager.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigFieldTypePluginManager.php @@ -8,19 +8,16 @@ namespace Drupal\field\Plugin\Type\FieldType; -use Drupal\Component\Plugin\PluginManagerBase; -use Drupal\Component\Plugin\Discovery\ProcessDecorator; +use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Plugin\Discovery\CacheDecorator; -use Drupal\Core\Plugin\Discovery\AlterDecorator; -use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; +use Drupal\Core\Language\LanguageManager; +use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\field\Plugin\Type\FieldType\LegacyFieldTypeDiscoveryDecorator; -use Drupal\Component\Plugin\Factory\ReflectionFactory; /** * Plugin manager for 'configurable field type' plugins. */ -class ConfigFieldTypePluginManager extends PluginManagerBase { +class ConfigFieldTypePluginManager extends DefaultPluginManager { /** * {@inheritdoc} @@ -32,19 +29,27 @@ class ConfigFieldTypePluginManager extends PluginManagerBase { ); /** - * {@inheritdoc} + * Constructs the ConfigFieldTypePluginManager object + * + * @param \Traversable $namespaces + * An object that implements \Traversable which contains the root paths + * keyed by the corresponding namespace to look for plugin implementations. + * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend + * Cache backend instance to use. + * @param \Drupal\Core\Language\LanguageManager $language_manager + * The language manager. + * @param \Drupal\Core\Extension\ModuleHandlerInterface + * The module handler. */ - public function __construct(\Traversable $namespaces, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { $annotation_namespaces = array('Drupal\field\Annotation' => $namespaces['Drupal\field']); - $this->discovery = new AnnotatedClassDiscovery('field/field_type', $namespaces, $annotation_namespaces, 'Drupal\field\Annotation\ConfigFieldType'); + parent::__construct('field/field_type', $namespaces, $annotation_namespaces, 'Drupal\field\Annotation\ConfigFieldType'); + $this->alterInfo($module_handler, 'field_info'); + $this->setCacheBackend($cache_backend, $language_manager, 'field_types'); + // @todo Remove once all core field types have been converted (see // http://drupal.org/node/2014671). $this->discovery = new LegacyFieldTypeDiscoveryDecorator($this->discovery, $module_handler); - $this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition')); - $this->discovery = new AlterDecorator($this->discovery, 'field_info'); - $this->discovery = new CacheDecorator($this->discovery, 'field_types', 'field'); - - $this->factory = new ReflectionFactory($this); } }