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