You are here

public function ExplorerController::viewExplorer in GraphQL 8.2

Same name and namespace in other branches
  1. 8.4 src/Controller/ExplorerController.php \Drupal\graphql\Controller\ExplorerController::viewExplorer()
  2. 8 src/Controller/ExplorerController.php \Drupal\graphql\Controller\ExplorerController::viewExplorer()
  3. 8.3 src/Controller/ExplorerController.php \Drupal\graphql\Controller\ExplorerController::viewExplorer()

Controller for the GraphiQL query builder IDE.

Return value

array The render array.

1 string reference to 'ExplorerController::viewExplorer'
graphql.routing.yml in ./graphql.routing.yml
graphql.routing.yml

File

src/Controller/ExplorerController.php, line 49

Class

ExplorerController
Controller for the GraphiQL query builder IDE.

Namespace

Drupal\graphql\Controller

Code

public function viewExplorer() {
  $url = $this->urlGenerator
    ->generate('graphql.request');
  return [
    '#type' => 'page',
    '#theme' => 'page__graphql_explorer',
    '#attached' => [
      'library' => [
        'graphql/explorer',
      ],
      'drupalSettings' => [
        'graphQLRequestUrl' => $url,
      ],
    ],
  ];
}