Skip to content

Commit 24f86e2

Browse files
feat(route_load): Add optional language parameter to route_load data producer (#1328)
1 parent 3dd570c commit 24f86e2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Plugin/GraphQL/DataProducer/Routing/RouteLoad.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
* consumes = {
2525
* "path" = @ContextDefinition("string",
2626
* label = @Translation("Path")
27+
* ),
28+
* "language" = @ContextDefinition("string",
29+
* label = @Translation("Language"),
30+
* required = FALSE
2731
* )
2832
* }
2933
* )
@@ -90,12 +94,13 @@ public function __construct(
9094
* Resolver.
9195
*
9296
* @param string $path
97+
* @param string $language
9398
* @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface $metadata
9499
*
95100
* @return \Drupal\Core\Url|null
96101
*/
97-
public function resolve($path, RefinableCacheableDependencyInterface $metadata) {
98-
$redirect = $this->redirectRepository ? $this->redirectRepository->findMatchingRedirect($path, []) : NULL;
102+
public function resolve($path, $language, RefinableCacheableDependencyInterface $metadata) {
103+
$redirect = $this->redirectRepository ? $this->redirectRepository->findMatchingRedirect($path, [], $language) : NULL;
99104
if ($redirect !== NULL) {
100105
$url = $redirect->getRedirectUrl();
101106
}

0 commit comments

Comments
 (0)