You are here

public function FieldContext::getContextValue in GraphQL 8.4

Get a contextual value for the current field.

Allows field resolvers to inherit contextual values from their ancestors.

Parameters

string $name: The name of the context.

Return value

mixed The current value of the given context or the given default value if the context wasn't set.

File

src/GraphQL/Execution/FieldContext.php, line 101

Class

FieldContext
Context that is passed to data producer plugins.

Namespace

Drupal\graphql\GraphQL\Execution

Code

public function getContextValue($name) {
  return $this->context
    ->getContextValue($this->info, $name);
}