public static function MutationPluginBase::createInstance in GraphQL 8.3
Parameters
\Drupal\graphql\Plugin\SchemaBuilderInterface $builder:
\Drupal\graphql\Plugin\MutationPluginManager $manager:
$definition:
$id:
Return value
mixed
Overrides MutationPluginInterface::createInstance
File
- src/
Plugin/ GraphQL/ Mutations/ MutationPluginBase.php, line 23
Class
Namespace
Drupal\graphql\Plugin\GraphQL\MutationsCode
public static function createInstance(SchemaBuilderInterface $builder, MutationPluginManager $manager, $definition, $id) {
return [
'description' => $definition['description'],
'deprecationReason' => $definition['deprecationReason'],
'type' => $builder
->processType($definition['type']),
'args' => $builder
->processArguments($definition['args']),
'resolve' => function ($value, $args, $context, $info) use ($manager, $id) {
$instance = $manager
->getInstance([
'id' => $id,
]);
return call_user_func_array([
$instance,
'resolve',
], [
$value,
$args,
$context,
$info,
]);
},
];
}