diff --git a/src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php index 4d4ac27acf..1d6fb6e695 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php @@ -24,14 +24,18 @@ class SiteAccessChoiceLoader implements ChoiceLoaderInterface private SiteAccessNameGeneratorInterface $siteAccessNameGenerator; + private ?string $languageCode; + public function __construct( SiteaccessResolverInterface $nonAdminSiteaccessResolver, SiteAccessNameGeneratorInterface $siteAccessNameGenerator, - ?Location $location = null + ?Location $location = null, + ?string $languageCode = null ) { $this->nonAdminSiteaccessResolver = $nonAdminSiteaccessResolver; $this->location = $location; $this->siteAccessNameGenerator = $siteAccessNameGenerator; + $this->languageCode = $languageCode; } /** @@ -41,7 +45,11 @@ public function getChoiceList(): array { $siteAccesses = $this->location === null ? $this->nonAdminSiteaccessResolver->getSiteAccessesList() - : $this->nonAdminSiteaccessResolver->getSiteAccessesListForLocation(($this->location)); + : $this->nonAdminSiteaccessResolver->getSiteAccessesListForLocation( + $this->location, + null, + $this->languageCode + ); $data = []; foreach ($siteAccesses as $siteAccess) { diff --git a/src/lib/Form/Type/Preview/SiteAccessChoiceType.php b/src/lib/Form/Type/Preview/SiteAccessChoiceType.php index 7f8c851a1c..6324ef40f9 100644 --- a/src/lib/Form/Type/Preview/SiteAccessChoiceType.php +++ b/src/lib/Form/Type/Preview/SiteAccessChoiceType.php @@ -51,7 +51,8 @@ public function configureOptions(OptionsResolver $resolver): void new SiteAccessChoiceLoader( $this->siteAccessResolver, $this->siteAccessNameGenerator, - $options['location'] + $options['location'], + $options['languageCode'], ), $this->urlGenerator, $options['content']->id,