public function FieldPluginBase::resolve in GraphQL 8.3
1 call to FieldPluginBase::resolve()
- Route::resolve in modules/
graphql_core/ src/ Plugin/ GraphQL/ Fields/ Routing/ Route.php - Execute routing in language context.
1 method overrides FieldPluginBase::resolve()
- Route::resolve in modules/
graphql_core/ src/ Plugin/ GraphQL/ Fields/ Routing/ Route.php - Execute routing in language context.
File
- src/
Plugin/ GraphQL/ Fields/ FieldPluginBase.php, line 113
Class
Namespace
Drupal\graphql\Plugin\GraphQL\FieldsCode
public function resolve($value, array $args, ResolveContext $context, ResolveInfo $info) {
$definition = $this
->getPluginDefinition();
// If not resolving in a trusted environment, check if the field is secure.
if (!$context
->getGlobal('development', FALSE) && !$context
->getGlobal('bypass field security', FALSE)) {
if (empty($definition['secure'])) {
throw new \Exception(sprintf("Unable to resolve insecure field '%s'.", $info->fieldName));
}
}
foreach ($definition['contextual_arguments'] as $argument) {
if (array_key_exists($argument, $args) && !is_null($args[$argument])) {
$context
->setContext($argument, $args[$argument], $info);
}
$args[$argument] = $context
->getContext($argument, $info);
}
return $this
->resolveDeferred([
$this,
'resolveValues',
], $value, $args, $context, $info);
}