X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FEntity%2FPlugin%2FDataType%2FDeriver%2FEntityDeriver.php;fp=web%2Fcore%2Flib%2FDrupal%2FCore%2FEntity%2FPlugin%2FDataType%2FDeriver%2FEntityDeriver.php;h=38ac960cc17a375b8adfe854d4a3ea06175cfbab;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=5114c40f8ea08f54b53949a6cad01355f07d9841;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php b/web/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php index 5114c40f8..38ac960cc 100644 --- a/web/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php +++ b/web/core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php @@ -2,8 +2,11 @@ namespace Drupal\Core\Entity\Plugin\DataType\Deriver; +use Drupal\Core\Config\Entity\ConfigEntityInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; +use Drupal\Core\Entity\Plugin\DataType\ConfigEntityAdapter; +use Drupal\Core\Entity\Plugin\DataType\EntityAdapter; use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -86,7 +89,9 @@ class EntityDeriver implements ContainerDeriverInterface { $this->derivatives[''] = $base_plugin_definition; // Add definitions for each entity type and bundle. foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { + $class = $entity_type->entityClassImplements(ConfigEntityInterface::class) ? ConfigEntityAdapter::class : EntityAdapter::class; $this->derivatives[$entity_type_id] = [ + 'class' => $class, 'label' => $entity_type->getLabel(), 'constraints' => $entity_type->getConstraints(), 'internal' => $entity_type->isInternal(), @@ -96,8 +101,9 @@ class EntityDeriver implements ContainerDeriverInterface { foreach ($this->bundleInfoService->getBundleInfo($entity_type_id) as $bundle => $bundle_info) { if ($bundle !== $entity_type_id) { $this->derivatives[$entity_type_id . ':' . $bundle] = [ + 'class' => $class, 'label' => $bundle_info['label'], - 'constraints' => $this->derivatives[$entity_type_id]['constraints'] + 'constraints' => $this->derivatives[$entity_type_id]['constraints'], ] + $base_plugin_definition; } }