You are here

public function ExplorerPageDisplayVariantSubscriber::onSelectPageDisplayVariant in GraphQL 8.2

Same name and namespace in other branches
  1. 8 src/EventSubscriber/ExplorerPageDisplayVariantSubscriber.php \Drupal\graphql\EventSubscriber\ExplorerPageDisplayVariantSubscriber::onSelectPageDisplayVariant()
  2. 8.3 src/EventSubscriber/ExplorerPageDisplayVariantSubscriber.php \Drupal\graphql\EventSubscriber\ExplorerPageDisplayVariantSubscriber::onSelectPageDisplayVariant()

Disables any display variant on the explorer page.

Parameters

\Drupal\Core\Render\PageDisplayVariantSelectionEvent $event: The event to process.

File

src/EventSubscriber/ExplorerPageDisplayVariantSubscriber.php, line 19

Class

ExplorerPageDisplayVariantSubscriber
Disables any display variant on the explorer page.

Namespace

Drupal\graphql\EventSubscriber

Code

public function onSelectPageDisplayVariant(PageDisplayVariantSelectionEvent $event) {
  if ($event
    ->getRouteMatch()
    ->getRouteName() === 'graphql.explorer') {
    $event
      ->setPluginId(NULL)
      ->stopPropagation();
  }
}