public function Route::resolve in GraphQL 8.3
Execute routing in language context.
Language context has to be inferred from the path prefix, but set before `resolveValues` is invoked.
Overrides FieldPluginBase::resolve
File
- modules/
graphql_core/ src/ Plugin/ GraphQL/ Fields/ Routing/ Route.php, line 124
Class
- Route
- Retrieve a route object based on a path.
Namespace
Drupal\graphql_core\Plugin\GraphQL\Fields\RoutingCode
public function resolve($value, array $args, ResolveContext $context, ResolveInfo $info) {
// For now we just take the "url" negotiator into account.
if ($this->languageManager
->isMultilingual() && $this->languageNegotiator) {
if ($negotiator = $this->languageNegotiator
->getNegotiationMethodInstance('language-url')) {
$context
->setContext('language', $negotiator
->getLangcode(Request::create($args['path'])), $info);
}
else {
$context
->setContext('language', $this->languageManager
->getDefaultLanguage()
->getId(), $info);
}
}
return parent::resolve($value, $args, $context, $info);
}