abstract class EntityFieldDeriverBase in GraphQL 8.3
Generate GraphQLField plugins for config fields.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\graphql_core\Plugin\Deriver\EntityFieldDeriverBase implements ContainerDeriverInterface uses DependencySerializationTrait
Expanded class hierarchy of EntityFieldDeriverBase
4 files declare their use of EntityFieldDeriverBase
- EntityFieldDeriver.php in modules/
graphql_core/ src/ Plugin/ Deriver/ Fields/ EntityFieldDeriver.php - EntityFieldItemDeriver.php in modules/
graphql_core/ src/ Plugin/ Deriver/ Fields/ EntityFieldItemDeriver.php - EntityFieldPropertyDeriver.php in modules/
graphql_core/ src/ Plugin/ Deriver/ Fields/ EntityFieldPropertyDeriver.php - EntityFieldTypeDeriver.php in modules/
graphql_core/ src/ Plugin/ Deriver/ Types/ EntityFieldTypeDeriver.php
File
- modules/
graphql_core/ src/ Plugin/ Deriver/ EntityFieldDeriverBase.php, line 19
Namespace
Drupal\graphql_core\Plugin\DeriverView source
abstract class EntityFieldDeriverBase extends DeriverBase implements ContainerDeriverInterface {
use DependencySerializationTrait;
/**
* Provides plugin definition values from fields.
*
* @param \Drupal\Core\Field\FieldDefinitionInterface $fieldDefinition
* Field definition object.
* @param array $basePluginDefinition
* Base definition array.
*
* @return array
* The derived plugin definitions for the given field.
*/
protected abstract function getDerivativeDefinitionsFromFieldDefinition(FieldDefinitionInterface $fieldDefinition, array $basePluginDefinition);
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* The entity field manager.
*
* @var \Drupal\Core\Entity\EntityFieldManagerInterface
*/
protected $entityFieldManager;
/**
* The entity bundle info.
*
* @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface
*/
protected $entityBundleInfo;
/**
* The base plugin id.
*
* @var string
*/
protected $basePluginId;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $basePluginId) {
return new static($container
->get('entity_type.manager'), $container
->get('entity_field.manager'), $container
->get('entity_type.bundle.info'), $basePluginId);
}
/**
* RawValueFieldItemDeriver constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* The entity type manager.
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entityFieldManager
* The entity field manager.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entityTypeBundleInfo
* The bundle info service.
* @param string $basePluginId
* The base plugin id.
*/
public function __construct(EntityTypeManagerInterface $entityTypeManager, EntityFieldManagerInterface $entityFieldManager, EntityTypeBundleInfoInterface $entityTypeBundleInfo, $basePluginId) {
$this->basePluginId = $basePluginId;
$this->entityTypeManager = $entityTypeManager;
$this->entityFieldManager = $entityFieldManager;
$this->entityBundleInfo = $entityTypeBundleInfo;
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($basePluginDefinition) {
foreach ($this->entityTypeManager
->getDefinitions() as $entityTypeId => $entityType) {
if (!$entityType
->entityClassImplements(FieldableEntityInterface::class)) {
continue;
}
foreach ($this->entityFieldManager
->getBaseFieldDefinitions($entityTypeId) as $fieldDefinition) {
if ($derivatives = $this
->getDerivativeDefinitionsFromFieldDefinition($fieldDefinition, $basePluginDefinition)) {
$this->derivatives = array_merge($this->derivatives, $derivatives);
}
}
foreach ($this->entityBundleInfo
->getBundleInfo($entityTypeId) as $bundleId => $bundleInfo) {
foreach ($this->entityFieldManager
->getFieldDefinitions($entityTypeId, $bundleId) as $fieldDefinition) {
if ($derivatives = $this
->getDerivativeDefinitionsFromFieldDefinition($fieldDefinition, $basePluginDefinition)) {
$this->derivatives = array_merge($this->derivatives, $derivatives);
}
}
}
}
return $this->derivatives;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
EntityFieldDeriverBase:: |
protected | property | The base plugin id. | |
EntityFieldDeriverBase:: |
protected | property | The entity bundle info. | |
EntityFieldDeriverBase:: |
protected | property | The entity field manager. | |
EntityFieldDeriverBase:: |
protected | property | The entity type manager. | |
EntityFieldDeriverBase:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
EntityFieldDeriverBase:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
EntityFieldDeriverBase:: |
abstract protected | function | Provides plugin definition values from fields. | 4 |
EntityFieldDeriverBase:: |
public | function | RawValueFieldItemDeriver constructor. |