Mercurial > hg > cmmr2012-drupal-site
diff core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | c75dbcec494b |
children |
line wrap: on
line diff
--- a/core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php Thu Feb 28 13:11:55 2019 +0000 +++ b/core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php Thu May 09 15:34:47 2019 +0100 @@ -2,11 +2,11 @@ namespace Drupal\Core\ParamConverter; +use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\Entity\ConfigEntityInterface; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Routing\AdminContext; use Symfony\Component\Routing\Route; -use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Entity\EntityManagerInterface; /** * Makes sure the unmodified ConfigEntity is loaded on admin pages. @@ -42,15 +42,17 @@ /** * Constructs a new EntityConverter. * - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager. + * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager + * The entity type manager. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The config factory. * @param \Drupal\Core\Routing\AdminContext $admin_context * The route admin context service. + * @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository + * The entity repository. */ - public function __construct(EntityManagerInterface $entity_manager, ConfigFactoryInterface $config_factory, AdminContext $admin_context) { - parent::__construct($entity_manager); + public function __construct(EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory, AdminContext $admin_context, $entity_repository = NULL) { + parent::__construct($entity_type_manager, $entity_repository); $this->configFactory = $config_factory; $this->adminContext = $admin_context; @@ -65,13 +67,13 @@ // If the entity type is dynamic, confirm it to be a config entity. Static // entity types will have performed this check in self::applies(). if (strpos($definition['type'], 'entity:{') === 0) { - $entity_type = $this->entityManager->getDefinition($entity_type_id); + $entity_type = $this->entityTypeManager->getDefinition($entity_type_id); if (!$entity_type->entityClassImplements(ConfigEntityInterface::class)) { return parent::convert($value, $definition, $name, $defaults); } } - if ($storage = $this->entityManager->getStorage($entity_type_id)) { + if ($storage = $this->entityTypeManager->getStorage($entity_type_id)) { // Make sure no overrides are loaded. return $storage->loadOverrideFree($value); } @@ -93,7 +95,7 @@ } // As we only want to override EntityConverter for ConfigEntities, find // out whether the current entity is a ConfigEntity. - $entity_type = $this->entityManager->getDefinition($entity_type_id); + $entity_type = $this->entityTypeManager->getDefinition($entity_type_id); if ($entity_type->entityClassImplements(ConfigEntityInterface::class)) { return $this->adminContext->isAdminRoute($route); }