diff --git a/core/core.services.yml b/core/core.services.yml index 787f05e..7feecd8 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -151,9 +151,6 @@ services: plugin.manager.entity: class: Drupal\Core\Entity\EntityManager arguments: ['@container.namespaces'] - calls: - - [setAlterHook, ['@module_handler', 'entity_info']] - - [setCache, ['@cache.cache', 'entity_info']] plugin.manager.archiver: class: Drupal\Core\Archiver\ArchiverManager arguments: ['@container.namespaces'] diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 11c3a10..9e1d12f 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -7,7 +7,13 @@ namespace Drupal\Core\Entity; -use Drupal\Core\Plugin\DefaultPluginManager; +use Drupal\Component\Plugin\PluginManagerBase; +use Drupal\Component\Plugin\Factory\DefaultFactory; +use Drupal\Core\Plugin\Discovery\AlterDecorator; +use Drupal\Core\Plugin\Discovery\CacheDecorator; +use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; +use Drupal\Core\Plugin\Discovery\InfoHookDecorator; +use Drupal\Core\Cache\CacheBackendInterface; /** * Manages entity type plugin definitions. @@ -23,7 +29,7 @@ * @see entity_get_info() * @see hook_entity_info_alter() */ -class EntityManager extends DefaultPluginManager { +class EntityManager extends PluginManagerBase { /** * Contains instantiated controllers keyed by controller type and entity type. @@ -44,7 +50,12 @@ public function __construct(\Traversable $namespaces) { $annotation_namespaces = array( 'Drupal\Core\Entity\Annotation' => DRUPAL_ROOT . '/core/lib', ); - parent::__construct('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)); + + $this->factory = new DefaultFactory($this->discovery); } /**