Skip to content

Commit 71f5c5f

Browse files
authored
Fixing language switch links. (#521)
1 parent 323b040 commit 71f5c5f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • modules/graphql_core/src/Plugin/GraphQL/Fields/Routing

modules/graphql_core/src/Plugin/GraphQL/Fields/Routing/Translate.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ public function resolveValues($value, array $args, ResolveInfo $info) {
7474
if ($value instanceof Url) {
7575
$language = $this->languageManager->getLanguage($args['language']);
7676
$url = clone $value;
77+
78+
// The routed path is cached in the original object. Clear it.
79+
if ($url->isRouted() && $url->getOption('routed_path')) {
80+
$url->setOption('routed_path', NULL);
81+
}
82+
7783
yield $url->setOption('language', $language);
7884
}
7985
}

0 commit comments

Comments
 (0)