You are here

public function ContextRepository::getRuntimeContexts in GraphQL 8.3

Gets runtime context values for the given context IDs.

Given that context providers might not return contexts for the given context IDs, it is also not guaranteed that the context repository returns contexts for all specified IDs.

Parameters

string[] $context_ids: Fully qualified context IDs, which looks like service_id}:{unqualified_context_id}, so for example node.node_route_context:node.

Return value

\Drupal\Core\Plugin\Context\ContextInterface[] The determined contexts, keyed by the fully qualified context ID.

Overrides ContextRepositoryInterface::getRuntimeContexts

File

src/GraphQL/Context/ContextRepository.php, line 36

Class

ContextRepository
Non-lazy un-optimized context repository.

Namespace

Drupal\graphql\GraphQL\Context

Code

public function getRuntimeContexts(array $contextIds) {
  $contexts = [];
  foreach ($this->contextProviders as $contextProvider) {
    foreach ($contextProvider
      ->getRuntimeContexts($contextIds) as $id => $context) {
      $contexts[$id] = $context;
    }
  }
  return $contexts;
}