protected function ExampleSchemaExtension::addQueryFields in GraphQL 8.4
Parameters
\Drupal\graphql\GraphQL\ResolverRegistryInterface $registry:
\Drupal\graphql\GraphQL\ResolverBuilder $builder:
1 call to ExampleSchemaExtension::addQueryFields()
- ExampleSchemaExtension::registerResolvers in examples/
graphql_example/ src/ Plugin/ GraphQL/ SchemaExtension/ ExampleSchemaExtension.php - Registers type and field resolvers in the shared registry.
File
- examples/
graphql_example/ src/ Plugin/ GraphQL/ SchemaExtension/ ExampleSchemaExtension.php, line 53
Class
- ExampleSchemaExtension
- Plugin annotation @SchemaExtension( id = "example_extension", name = "Example extension", description = "A simple extension that adds node related fields.", schema = "example" )
Namespace
Drupal\graphql_examples\Plugin\GraphQL\SchemaExtensionCode
protected function addQueryFields(ResolverRegistryInterface $registry, ResolverBuilder $builder) : void {
$registry
->addFieldResolver('Query', 'page', $builder
->produce('entity_load')
->map('type', $builder
->fromValue('node'))
->map('bundles', $builder
->fromValue([
'page',
]))
->map('id', $builder
->fromArgument('id')));
}