Skip to content

Commit

Permalink
[PATCH] Add optional language parameter to route_load data producer
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphvandenhoudt committed Mar 7, 2023
1 parent 23e43bb commit d6ca744
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Plugin/GraphQL/DataProducer/Routing/RouteLoad.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
* consumes = {
* "path" = @ContextDefinition("string",
* label = @Translation("Path")
* ),
* "language" = @ContextDefinition("string",
* label = @Translation("Language"),
* required = FALSE
* )
* }
* )
Expand Down Expand Up @@ -90,12 +94,13 @@ public function __construct(
* Resolver.
*
* @param string $path
* @param string $language
* @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface $metadata
*
* @return \Drupal\Core\Url|null
*/
public function resolve($path, RefinableCacheableDependencyInterface $metadata) {
$redirect = $this->redirectRepository ? $this->redirectRepository->findMatchingRedirect($path, []) : NULL;
public function resolve($path, $language, RefinableCacheableDependencyInterface $metadata) {
$redirect = $this->redirectRepository ? $this->redirectRepository->findMatchingRedirect($path, [], $language) : NULL;
if ($redirect !== NULL) {
$url = $redirect->getRedirectUrl();
}
Expand Down

0 comments on commit d6ca744

Please sign in to comment.