public function EntityRevisionByIdDeriver::getDerivativeDefinitions in GraphQL 8.3
Gets the definition of all derivatives of a base plugin.
Parameters
array $base_plugin_definition: The definition array of the base plugin.
Return value
array An array of full derivative definitions keyed on derivative id.
Overrides DeriverBase::getDerivativeDefinitions
See also
getDerivativeDefinition()
File
- modules/
graphql_core/ src/ Plugin/ Deriver/ Fields/ EntityRevisionByIdDeriver.php, line 44
Class
Namespace
Drupal\graphql_core\Plugin\Deriver\FieldsCode
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);
}