Skip to content

Commit

Permalink
IBX-9293: Base site access choice loader on language code
Browse files Browse the repository at this point in the history
  • Loading branch information
barw4 committed Jan 15, 2025
1 parent d6d83c7 commit 77fabcf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/lib/Form/Type/Preview/SiteAccessChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 77fabcf

Please sign in to comment.