You are here

public function FieldContext::setContextValue in GraphQL 8.4

Sets a contextual value for the current field and its descendants.

Allows field resolvers to set contextual values which can be inherited by their descendants.

Parameters

string $name: The name of the context.

mixed $value: The value of the context.

Return value

$this

File

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

Class

FieldContext
Context that is passed to data producer plugins.

Namespace

Drupal\graphql\GraphQL\Execution

Code

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