class ExplorerPageDisplayVariantSubscriber in GraphQL 8.2
Same name and namespace in other branches
- 8 src/EventSubscriber/ExplorerPageDisplayVariantSubscriber.php \Drupal\graphql\EventSubscriber\ExplorerPageDisplayVariantSubscriber
- 8.3 src/EventSubscriber/ExplorerPageDisplayVariantSubscriber.php \Drupal\graphql\EventSubscriber\ExplorerPageDisplayVariantSubscriber
Disables any display variant on the explorer page.
Hierarchy
- class \Drupal\graphql\EventSubscriber\ExplorerPageDisplayVariantSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of ExplorerPageDisplayVariantSubscriber
1 string reference to 'ExplorerPageDisplayVariantSubscriber'
1 service uses ExplorerPageDisplayVariantSubscriber
File
- src/
EventSubscriber/ ExplorerPageDisplayVariantSubscriber.php, line 12
Namespace
Drupal\graphql\EventSubscriberView source
class ExplorerPageDisplayVariantSubscriber implements EventSubscriberInterface {
/**
* Disables any display variant on the explorer page.
*
* @param \Drupal\Core\Render\PageDisplayVariantSelectionEvent $event
* The event to process.
*/
public function onSelectPageDisplayVariant(PageDisplayVariantSelectionEvent $event) {
if ($event
->getRouteMatch()
->getRouteName() === 'graphql.explorer') {
$event
->setPluginId(NULL)
->stopPropagation();
}
}
/**
* {@inheritdoc}
*/
static function getSubscribedEvents() {
$events[RenderEvents::SELECT_PAGE_DISPLAY_VARIANT][] = [
'onSelectPageDisplayVariant',
];
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ExplorerPageDisplayVariantSubscriber:: |
static | function | Returns an array of event names this subscriber wants to listen to. | |
ExplorerPageDisplayVariantSubscriber:: |
public | function | Disables any display variant on the explorer page. |