class VoyagerController in GraphQL 8.3
Same name and namespace in other branches
- 8.4 src/Controller/VoyagerController.php \Drupal\graphql\Controller\VoyagerController
Controller for the GraphQL Voyager visualisation API.
Hierarchy
- class \Drupal\graphql\Controller\VoyagerController implements ContainerInjectionInterface
Expanded class hierarchy of VoyagerController
File
- src/
Controller/ VoyagerController.php, line 12
Namespace
Drupal\graphql\ControllerView source
class VoyagerController implements ContainerInjectionInterface {
/**
* The introspection service.
*
* @var \Drupal\graphql\GraphQL\Utility\Introspection
*/
protected $introspection;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('graphql.introspection'));
}
/**
* VoyagerController constructor.
*
* @param \Drupal\graphql\GraphQL\Utility\Introspection $introspection
* The GraphQL introspection service.
*/
public function __construct(Introspection $introspection) {
$this->introspection = $introspection;
}
/**
* Display for the GraphQL Voyager visualization API.
*
* @param string $schema
* The name of the schema to use.
*
* @return array The render array.
* The render array.
*/
public function viewVoyager($schema) {
$introspectionData = $this->introspection
->introspect($schema);
return [
'#type' => 'page',
'#theme' => 'page__graphql_voyager',
'#attached' => [
'library' => [
'graphql/voyager',
],
'drupalSettings' => [
'graphqlIntrospectionData' => $introspectionData,
],
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
VoyagerController:: |
protected | property | The introspection service. | |
VoyagerController:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
VoyagerController:: |
public | function | Display for the GraphQL Voyager visualization API. | |
VoyagerController:: |
public | function | VoyagerController constructor. |