You are here

public function SubrequestSubscriber::onKernelRequest in GraphQL 8.4

Same name and namespace in other branches
  1. 8.3 src/EventSubscriber/SubrequestSubscriber.php \Drupal\graphql\EventSubscriber\SubrequestSubscriber::onKernelRequest()

Handle kernel request events.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseEvent $event: The kernel event object.

File

src/EventSubscriber/SubrequestSubscriber.php, line 42

Class

SubrequestSubscriber
Sets the language on subrequests.

Namespace

Drupal\graphql\EventSubscriber

Code

public function onKernelRequest(GetResponseEvent $event) : void {
  $request = $event
    ->getRequest();
  if (!$request->attributes
    ->has('_graphql_subrequest')) {
    return;
  }
  $request->attributes
    ->set('_controller', '\\Drupal\\graphql\\Controller\\SubrequestExtractionController:extract');
  $this
    ->resetLanguageContext();
}