66use Drupal \Core \Entity \EntityTypeBundleInfoInterface ;
77use Drupal \Core \Entity \EntityTypeManagerInterface ;
88use Drupal \Core \Entity \FieldableEntityInterface ;
9+ use Drupal \Core \Field \BaseFieldDefinition ;
910use Drupal \Core \Field \FieldStorageDefinitionInterface ;
1011use Drupal \Core \Plugin \Discovery \ContainerDeriverInterface ;
1112use Drupal \Core \Entity \EntityFieldManagerInterface ;
12- use Drupal \graphql \Utility \StringHelper ;
13- use Drupal \graphql_content \ContentEntitySchemaConfig ;
1413use Symfony \Component \DependencyInjection \ContainerInterface ;
1514
1615/**
1918abstract class EntityFieldDeriverBase extends DeriverBase implements ContainerDeriverInterface {
2019
2120 /**
22- * Provide plugin definition values from config field storage.
21+ * Provides plugin definition values from base fields.
22+ *
23+ * @param string $entityTypeId
24+ * The host entity type.
25+ * @param \Drupal\Core\Field\BaseFieldDefinition $baseFieldDefinition
26+ * Base field definition object.
27+ * @param array $basePluginDefinition
28+ * Base definition array.
29+ */
30+ protected function getBaseFieldDefinition ($ entityTypeId , BaseFieldDefinition $ baseFieldDefinition , array $ basePluginDefinition ) {}
31+
32+ /**
33+ * Provides plugin definition values from config field storage.
2334 *
2435 * @param string $entityTypeId
2536 * The host entity type.
@@ -30,7 +41,7 @@ abstract class EntityFieldDeriverBase extends DeriverBase implements ContainerDe
3041 * @param array $basePluginDefinition
3142 * Base definition array.
3243 */
33- protected abstract function getConfigFieldDefinition ($ entityTypeId , $ bundleId , FieldStorageDefinitionInterface $ storage , array $ basePluginDefinition );
44+ protected function getConfigFieldDefinition ($ entityTypeId , $ bundleId , FieldStorageDefinitionInterface $ storage , array $ basePluginDefinition ) {}
3445
3546 /**
3647 * The entity type manager.
@@ -68,18 +79,19 @@ public static function create(ContainerInterface $container, $basePluginId) {
6879 $ container ->get ('entity_type.manager ' ),
6980 $ container ->get ('entity_field.manager ' ),
7081 $ container ->get ('entity_type.bundle.info ' ),
71- $ basePluginId );
82+ $ basePluginId
83+ );
7284 }
7385
7486 /**
75- * AbstractFieldFormatterDeriver constructor.
87+ * RawValueFieldItemDeriver constructor.
7688 *
7789 * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
7890 * The entity type manager.
7991 * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entityFieldManager
8092 * The entity field manager.
8193 * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entityTypeBundleInfo
82- * The entity bundle info service.
94+ * The bundle info service.
8395 * @param string $basePluginId
8496 * The base plugin id.
8597 */
@@ -110,7 +122,9 @@ public function getDerivativeDefinitions($basePluginDefinition) {
110122 continue ;
111123 }
112124
113- // TODO Add base fields.
125+ foreach ($ this ->entityFieldManager ->getBaseFieldDefinitions ($ entityTypeId ) as $ baseFieldDefinition ) {
126+ $ this ->getBaseFieldDefinition ($ entityTypeId , $ baseFieldDefinition , $ basePluginDefinition );
127+ }
114128
115129 foreach ($ bundleInfo ->getBundleInfo ($ entityTypeId ) as $ bundleId => $ bundle ) {
116130 foreach ($ this ->entityFieldManager ->getFieldDefinitions ($ entityTypeId , $ bundleId ) as $ fieldDefinition ) {
0 commit comments