class EntityRevisionByIdDeriver in GraphQL 8.3
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\graphql_core\Plugin\Deriver\Fields\EntityRevisionByIdDeriver implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of EntityRevisionByIdDeriver
File
- modules/
graphql_core/ src/ Plugin/ Deriver/ Fields/ EntityRevisionByIdDeriver.php, line 13
Namespace
Drupal\graphql_core\Plugin\Deriver\FieldsView source
class EntityRevisionByIdDeriver extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $basePluginId) {
return new static($container
->get('entity_type.manager'));
}
/**
* EntityRevisionByIdDeriver constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* The entity type manager service.
*/
public function __construct(EntityTypeManagerInterface $entityTypeManager) {
$this->entityTypeManager = $entityTypeManager;
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($basePluginDefinition) {
foreach ($this->entityTypeManager
->getDefinitions() as $id => $type) {
if ($type instanceof ContentEntityTypeInterface && $type
->isRevisionable()) {
$derivative = [
'name' => StringHelper::propCase($id, 'revision', 'by', 'id'),
'type' => "entity:{$id}",
'description' => $this
->t("Loads '@type' entity revision by their revision id.", [
'@type' => $type
->getLabel(),
]),
'entity_type' => $id,
] + $basePluginDefinition;
if ($type
->isTranslatable()) {
$derivative['arguments']['language'] = [
'type' => 'LanguageId',
];
}
$this->derivatives["entity:{$id}"] = $derivative;
}
}
return parent::getDerivativeDefinitions($basePluginDefinition);
}
}
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:: |
|
EntityRevisionByIdDeriver:: |
protected | property | The entity type manager service. | |
EntityRevisionByIdDeriver:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
EntityRevisionByIdDeriver:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
EntityRevisionByIdDeriver:: |
public | function | EntityRevisionByIdDeriver constructor. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |