Skip to content
Snippets Groups Projects

Issue #3390590 by almunnings, Yury N, CedricL: MenuItem route should not inherit language from menu

Merged Issue #3390590 by almunnings, Yury N, CedricL: MenuItem route should not inherit language from menu
@@ -68,7 +68,7 @@ class ContextLanguage extends DataProducerPluginBase implements ContainerFactory
*
* It can do weird things if changing language mid-query.
*
* @param string|null $language
* @param string|null $langcode
* The language to resolve the url in.
* @param \Drupal\graphql\GraphQL\Execution\FieldContext $context
* The cache context.
@@ -76,14 +76,20 @@ class ContextLanguage extends DataProducerPluginBase implements ContainerFactory
* @return string|null
* The language in use.
*/
public function resolve(?string $language, FieldContext $context): ?string {
public function resolve(?string $langcode, FieldContext $context): ?string {
if ($langcode && $this->languageManager->isMultilingual()) {
$language = $this->languageManager->getLanguage($langcode);
if ($language) {
$context->setContextLanguage($langcode);
$this->languageManager->setConfigOverrideLanguage($language);
}
if ($language && $this->languageManager->isMultilingual()) {
$context->setContextLanguage($language);
$this->languageManager->reset();
}
return $language;
return $langcode;
}
}
Loading