You are here

public function DataProducerPluginBase::getContextDefinition in GraphQL 8.4

Throws

\Drupal\Component\Plugin\Exception\ContextException

Overrides ContextAwarePluginBase::getContextDefinition

File

src/Plugin/GraphQL/DataProducer/DataProducerPluginBase.php, line 29

Class

DataProducerPluginBase
Base class for data producers that resolve fields for queries or mutations.

Namespace

Drupal\graphql\Plugin\GraphQL\DataProducer

Code

public function getContextDefinition($name) {
  $definitions = $this
    ->getContextDefinitions();
  if (!empty($definitions[$name])) {
    return $definitions[$name];
  }
  throw new ContextException(sprintf("The %s context is not a valid context.", $name));
}