You are here

public function VoyagerController::viewVoyager in GraphQL 8.4

Same name and namespace in other branches
  1. 8.3 src/Controller/VoyagerController.php \Drupal\graphql\Controller\VoyagerController::viewVoyager()

Display for the GraphQL Voyager visualization API.

Parameters

\Drupal\graphql\Entity\ServerInterface $graphql_server: The server.

Return value

array The render array.

1 string reference to 'VoyagerController::viewVoyager'
graphql.routing.yml in ./graphql.routing.yml
graphql.routing.yml

File

src/Controller/VoyagerController.php, line 53

Class

VoyagerController
Controller for the GraphQL Voyager visualisation API.

Namespace

Drupal\graphql\Controller

Code

public function viewVoyager(ServerInterface $graphql_server) {
  $introspectionData = $this->introspection
    ->introspect($graphql_server);
  return [
    '#type' => 'markup',
    '#markup' => '<div id="graphql-voyager"></div>',
    '#attached' => [
      'library' => [
        'graphql/voyager',
      ],
      'drupalSettings' => [
        'graphqlIntrospectionData' => $introspectionData,
      ],
    ],
  ];
}