abstract class EntityTypeDeriverBase in GraphQL 8.3
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\graphql_core\Plugin\Deriver\EntityTypeDeriverBase implements ContainerDeriverInterface
Expanded class hierarchy of EntityTypeDeriverBase
3 files declare their use of EntityTypeDeriverBase
- EntityBundleDeriver.php in modules/
graphql_core/ src/ Plugin/ Deriver/ Types/ EntityBundleDeriver.php - EntityTypeDeriver.php in modules/
graphql_core/ src/ Plugin/ Deriver/ Interfaces/ EntityTypeDeriver.php - EntityTypeDeriver.php in modules/
graphql_core/ src/ Plugin/ Deriver/ Types/ EntityTypeDeriver.php
File
- modules/
graphql_core/ src/ Plugin/ Deriver/ EntityTypeDeriverBase.php, line 12
Namespace
Drupal\graphql_core\Plugin\DeriverView source
abstract class EntityTypeDeriverBase extends DeriverBase implements ContainerDeriverInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Bundle info manager.
*
* @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface
*/
protected $entityTypeBundleInfo;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $basePluginId) {
return new static($container
->get('entity_type.manager'), $container
->get('entity_type.bundle.info'));
}
/**
* EntityTypeDeriver constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* Instance of an entity type manager.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entityTypeBundleInfo
* Instance of the entity bundle info service.
*/
public function __construct(EntityTypeManagerInterface $entityTypeManager, EntityTypeBundleInfoInterface $entityTypeBundleInfo) {
$this->entityTypeManager = $entityTypeManager;
$this->entityTypeBundleInfo = $entityTypeBundleInfo;
}
/**
* Retrieve the interfaces that the entity type should implement.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $type
* The entity type to retrieve the interfaces for.
* @param array $basePluginDefinition
* The base plugin definition array.
*
* @return array
* The interfaces that this entity type should implement.
*/
protected function getInterfaces(EntityTypeInterface $type, array $basePluginDefinition) {
$pairs = [
'\\Drupal\\Core\\Entity\\EntityDescriptionInterface' => 'EntityDescribable',
'\\Drupal\\Core\\Entity\\EntityPublishedInterface' => 'EntityPublishable',
'\\Drupal\\user\\EntityOwnerInterface' => 'EntityOwnable',
];
$interfaces = isset($basePluginDefinition['interfaces']) ? $basePluginDefinition['interfaces'] : [];
$interfaces[] = 'Entity';
foreach ($pairs as $dependency => $interface) {
if ($type
->entityClassImplements($dependency)) {
$interfaces[] = $interface;
}
}
if ($type
->isRevisionable()) {
$interfaces[] = 'EntityRevisionable';
}
return array_unique($interfaces);
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
DeriverBase:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverInterface:: |
39 |
EntityTypeDeriverBase:: |
protected | property | Bundle info manager. | |
EntityTypeDeriverBase:: |
protected | property | The entity type manager. | |
EntityTypeDeriverBase:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
EntityTypeDeriverBase:: |
protected | function | Retrieve the interfaces that the entity type should implement. | |
EntityTypeDeriverBase:: |
public | function | EntityTypeDeriver constructor. |