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