You are here

public function OperationSubscriber::onBeforeOperation in GraphQL 8.4

Handle operation start events.

Parameters

\Drupal\graphql\Event\OperationEvent $event: The kernel event object.

File

src/EventSubscriber/OperationSubscriber.php, line 51

Class

OperationSubscriber
Sets the language before/after a GraphQL operation.

Namespace

Drupal\graphql\EventSubscriber

Code

public function onBeforeOperation(OperationEvent $event) : void {
  if ($this->moduleHandler
    ->moduleExists('language') && !empty($this->languageNegotiator)) {
    OperationLanguageNegotiation::setContext($event
      ->getContext());
  }
  $this
    ->resetLanguageContext();
}