public function EntityQueryDeriver::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/ EntityQueryDeriver.php, line 60
Class
Namespace
Drupal\graphql_core\Plugin\Deriver\FieldsCode
public function getDerivativeDefinitions($basePluginDefinition) {
foreach ($this->entityTypeManager
->getDefinitions() as $id => $type) {
if ($type instanceof ContentEntityTypeInterface) {
$derivative = [
'name' => StringHelper::propCase($id, 'query'),
'description' => $this
->t("Loads '@type' entities.", [
'@type' => $type
->getLabel(),
]),
'entity_type' => $id,
] + $basePluginDefinition;
if ($id === 'node') {
// TODO: Make this more generic.
$derivative['response_cache_contexts'][] = 'user.node_grants:view';
}
$this->derivatives[$id] = $derivative;
}
}
return parent::getDerivativeDefinitions($basePluginDefinition);
}