Issues (645)

ExplorerPageDisplayVariantSubscriber.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 explorer page.
11
 */
12
class ExplorerPageDisplayVariantSubscriber implements EventSubscriberInterface {
13
14
  /**
15
   * Disables any display variant on the explorer 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()->getRouteName(), 'graphql.explorer.') === 0) {
22
      $event->setPluginId(NULL)->stopPropagation();
23
    }
24
  }
25
26
  /**
27
   * {@inheritdoc}
28
   */
29
  public static function getSubscribedEvents() {
30
    $events = [
31
      RenderEvents::SELECT_PAGE_DISPLAY_VARIANT => [['onSelectPageDisplayVariant']],
32
    ];
33
34
    return $events;
35
  }
36
}
37