Issues (645)

VoyagerPageDisplayVariantSubscriber.php (3 issues)

Labels
Severity
1
<?php
2
3
namespace Drupal\graphql\EventSubscriber;
4
5
use Drupal\Core\Render\PageDisplayVariantSelectionEvent;
0 ignored issues
show
The type Drupal\Core\Render\PageD...ayVariantSelectionEvent was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Drupal\Core\Render\RenderEvents;
0 ignored issues
show
The type Drupal\Core\Render\RenderEvents was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
0 ignored issues
show
The type Symfony\Component\EventD...ventSubscriberInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
/**
10
 * Disables any display variant on the voyager page.
11
 */
12
class VoyagerPageDisplayVariantSubscriber implements EventSubscriberInterface {
13
14
  /**
15
   * Disables any display variant on the voyager page.
16
   *
17
   * @param \Drupal\Core\Render\PageDisplayVariantSelectionEvent $event
18
   *   The event to process.
19
   */
20
  public function onSelectPageDisplayVariant(PageDisplayVariantSelectionEvent $event) {
21
    if (strpos($event->getRouteMatch()
22
      ->getRouteName(), 'graphql.voyager.') === 0) {
23
      $event->setPluginId(NULL)->stopPropagation();
24
    }
25
  }
26
27
  /**
28
   * {@inheritdoc}
29
   */
30
  public static function getSubscribedEvents() {
31
    $events = [
32
      RenderEvents::SELECT_PAGE_DISPLAY_VARIANT => [['onSelectPageDisplayVariant']],
33
    ];
34
35
    return $events;
36
  }
37
38
}
39