public function VoyagerMenuLinkDeriver::getDerivativeDefinitions in GraphQL 8.4
Same name and namespace in other branches
- 8.3 src/Plugin/MenuLink/Deriver/VoyagerMenuLinkDeriver.php \Drupal\graphql\Plugin\MenuLink\Deriver\VoyagerMenuLinkDeriver::getDerivativeDefinitions()
Gets the definition of all derivatives of a base plugin.
Parameters
array $base_plugin_definition: The definition array of the base plugin.
Return value
array An array of full derivative definitions keyed on derivative id.
Overrides DeriverBase::getDerivativeDefinitions
See also
getDerivativeDefinition()
File
- src/
Plugin/ MenuLink/ Deriver/ VoyagerMenuLinkDeriver.php, line 20
Class
- VoyagerMenuLinkDeriver
- Generates one menu link per GraphQL server for Voyager.
Namespace
Drupal\graphql\Plugin\MenuLink\DeriverCode
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;
}