ExplorerMenuLinkDeriver.php in GraphQL 8.4
Same filename and directory in other branches
Namespace
Drupal\graphql\Plugin\MenuLink\DeriverFile
src/Plugin/MenuLink/Deriver/ExplorerMenuLinkDeriver.phpView source
<?php
namespace Drupal\graphql\Plugin\MenuLink\Deriver;
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\graphql\Entity\Server;
/**
* Generates one menu link per GraphQL server for Explorer.
*
* @package Drupal\graphql\Plugin\MenuLink\Deriver
*
* @codeCoverageIgnore
*/
class ExplorerMenuLinkDeriver extends DeriverBase {
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($basePluginDefinition) {
$servers = array_keys(Server::loadMultiple());
foreach ($servers as $id) {
$this->derivatives[$id] = [
'route_name' => "graphql.explorer.{$id}",
'parent' => 'entity.graphql_server.collection',
] + $basePluginDefinition;
}
return $this->derivatives;
}
}
Classes
Name | Description |
---|---|
ExplorerMenuLinkDeriver | Generates one menu link per GraphQL server for Explorer. |