diff --git a/core/core.services.yml b/core/core.services.yml index 15e079c..b1f3db8 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -435,7 +435,7 @@ services: arguments: ['@app.root', '@config.factory', '@module_handler', '@state', '@info_parser', '@logger.channel.default', '@asset.css.collection_optimizer', '@config.installer', '@config.manager', '@router.builder'] entity.manager: class: Drupal\Core\Entity\EntityManager - arguments: ['@container.namespaces', '@module_handler', '@cache.discovery', '@language_manager', '@string_translation', '@class_resolver', '@typed_data_manager', '@entity.definitions.installed', '@event_dispatcher', '@config.factory'] + arguments: ['@container.namespaces', '@module_handler', '@cache.discovery', '@language_manager', '@string_translation', '@class_resolver', '@typed_data_manager', '@entity.definitions.installed', '@event_dispatcher'] parent: container.trait tags: - { name: plugin_manager_cache_clear } diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 5568c8a..87579c7 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -135,13 +135,6 @@ class EntityManager extends DefaultPluginManager implements EntityManagerInterfa protected $eventDispatcher; /** - * The config factory. - * - * @var \Drupal\Core\Config\ConfigFactoryInterface - */ - protected $configFactory; - - /** * Static cache of bundle information. * * @var array @@ -204,10 +197,8 @@ class EntityManager extends DefaultPluginManager implements EntityManagerInterfa * The keyvalue collection for tracking installed definitions. * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher * The event dispatcher. - * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory - * The config factory. */ - public function __construct(\Traversable $namespaces, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, TranslationInterface $translation_manager, ClassResolverInterface $class_resolver, TypedDataManager $typed_data_manager, KeyValueStoreInterface $installed_definitions, EventDispatcherInterface $event_dispatcher, ConfigFactoryInterface $config_factory) { + public function __construct(\Traversable $namespaces, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, TranslationInterface $translation_manager, ClassResolverInterface $class_resolver, TypedDataManager $typed_data_manager, KeyValueStoreInterface $installed_definitions, EventDispatcherInterface $event_dispatcher) { parent::__construct('Entity', $namespaces, $module_handler, 'Drupal\Core\Entity\EntityInterface', 'Drupal\Core\Entity\Annotation\EntityType'); $this->setCacheBackend($cache, 'entity_type', array('entity_types')); @@ -219,7 +210,6 @@ public function __construct(\Traversable $namespaces, ModuleHandlerInterface $mo $this->typedDataManager = $typed_data_manager; $this->installedDefinitions = $installed_definitions; $this->eventDispatcher = $event_dispatcher; - $this->configFactory = $config_factory; } /** @@ -1042,10 +1032,7 @@ protected function getDisplayModeOptionsByBundle($display_type, $entity_type_id, $options = array('default' => t('Default')); // Collect all the entity's display modes. - $display_modes = $this->getDisplayModesByEntityType($display_type, $entity_type_id); - foreach ($display_modes as $display_mode_id => $display_mode) { - $options[$display_mode_id] = $display_mode['label']; - } + $display_modes = $this->getDisplayModeOptions($display_type, $entity_type_id); // Remove the displays that are not set to active for this bundle if they // should not be returned. @@ -1060,7 +1047,7 @@ protected function getDisplayModeOptionsByBundle($display_type, $entity_type_id, $displays = $this->getStorage($display_type == 'form_mode' ? 'entity_form_display' : 'entity_view_display') ->loadMultiple($load_ids); - // Unset the display modes that are not active or do not exists. + // Unset the display modes that are not active or do not exist. foreach (array_keys($display_modes) as $mode) { $display_id = $entity_type_id . '.' . $bundle . '.' . $mode; if (!isset($displays[$display_id]) || !$displays[$display_id]->status()) { diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php index ed2dc28..f4a218f 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php @@ -247,7 +247,7 @@ protected function setUpEntityManager($definitions = array()) { ->method('getDefinitions') ->will($this->returnValue($definitions)); - $this->entityManager = new TestEntityManager(new \ArrayObject(), $this->moduleHandler, $this->cacheBackend, $this->languageManager, $this->translationManager, $this->getClassResolverStub(), $this->typedDataManager, $this->installedDefinitions, $this->eventDispatcher, $this->configFactory); + $this->entityManager = new TestEntityManager(new \ArrayObject(), $this->moduleHandler, $this->cacheBackend, $this->languageManager, $this->translationManager, $this->getClassResolverStub(), $this->typedDataManager, $this->installedDefinitions, $this->eventDispatcher); $this->entityManager->setContainer($this->container); $this->entityManager->setDiscovery($this->discovery); }