public static function FieldPluginBase::createInstance in GraphQL 8.3
Parameters
\Drupal\graphql\Plugin\SchemaBuilderInterface $builder:
\Drupal\graphql\Plugin\FieldPluginManager $manager:
$definition:
$id:
Return value
mixed
Overrides FieldPluginInterface::createInstance
File
- src/
Plugin/ GraphQL/ Fields/ FieldPluginBase.php, line 56
Class
Namespace
Drupal\graphql\Plugin\GraphQL\FieldsCode
public static function createInstance(SchemaBuilderInterface $builder, FieldPluginManager $manager, $definition, $id) {
return [
'description' => $definition['description'],
'contexts' => $definition['contexts'],
'deprecationReason' => $definition['deprecationReason'],
'type' => $builder
->processType($definition['type']),
'args' => $builder
->processArguments($definition['args']),
'resolve' => function ($value, array $args, ResolveContext $context, ResolveInfo $info) use ($manager, $id) {
$instance = $manager
->getInstance([
'id' => $id,
]);
return $instance
->resolve($value, $args, $context, $info);
},
];
}