public function ResolveContext::hasContextValue in GraphQL 8.4
Checks whether contextual value for the current field exists.
Also checks ancestors of the field.
Parameters
\GraphQL\Type\Definition\ResolveInfo $info: The resolve info object.
string $name: The name of the context.
Return value
bool TRUE if the context exists, FALSE Otherwise.
File
- src/
GraphQL/ Execution/ ResolveContext.php, line 212
Class
- ResolveContext
- Context that is provided during resolving the GraphQL tree.
Namespace
Drupal\graphql\GraphQL\ExecutionCode
public function hasContextValue(ResolveInfo $info, $name) {
$path = $info->path;
do {
$key = implode('.', $path);
if (isset($this->contexts[$key]) && array_key_exists($name, $this->contexts[$key])) {
return TRUE;
}
array_pop($path);
} while (count($path));
return FALSE;
}