You are here

function graphql_graphql_schema_operations in GraphQL 8.3

Implements hook_graphql_schema_operations().

File

./graphql.module, line 171

Code

function graphql_graphql_schema_operations($pluginId, array $pluginDefinition) {
  $operations = [];
  if (\Drupal::currentUser()
    ->hasPermission('use graphql explorer')) {
    $operations['explorer'] = [
      'title' => 'Explorer',
      'weight' => 10,
      'url' => Url::fromRoute("graphql.explorer.{$pluginId}"),
    ];
  }
  if (\Drupal::currentUser()
    ->hasPermission('use graphql voyager')) {
    $operations['voyager'] = [
      'title' => 'Voyager',
      'weight' => 10,
      'url' => Url::fromRoute("graphql.voyager.{$pluginId}"),
    ];
  }
  return $operations;
}