From 27c74c50ea502ebf1f4cb06182d523d6829e8a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20D=C4=99bi=C5=84ski?= Date: Thu, 18 Nov 2021 12:14:17 +0100 Subject: [PATCH 1/2] IBX-1465: moved to the start of the siteAccess that is currently in use --- src/lib/UI/Config/Provider/Languages.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/UI/Config/Provider/Languages.php b/src/lib/UI/Config/Provider/Languages.php index f683ec295a..4638c74a09 100644 --- a/src/lib/UI/Config/Provider/Languages.php +++ b/src/lib/UI/Config/Provider/Languages.php @@ -10,6 +10,7 @@ use eZ\Publish\API\Repository\LanguageService; use eZ\Publish\Core\MVC\ConfigResolverInterface; +use eZ\Publish\Core\MVC\Symfony\SiteAccess; use EzSystems\EzPlatformAdminUi\UI\Config\ProviderInterface; /** @@ -26,6 +27,9 @@ class Languages implements ProviderInterface /** @var string[] */ private $siteAccesses; + /** @var \eZ\Publish\Core\MVC\Symfony\SiteAccess */ + private $siteAccess; + /** * @param \eZ\Publish\API\Repository\LanguageService $languageService * @param \eZ\Publish\Core\MVC\ConfigResolverInterface $configResolver @@ -34,10 +38,12 @@ class Languages implements ProviderInterface public function __construct( LanguageService $languageService, ConfigResolverInterface $configResolver, + SiteAccess $siteAccess, array $siteAccesses ) { $this->languageService = $languageService; $this->configResolver = $configResolver; + $this->siteAccess = $siteAccess; $this->siteAccesses = $siteAccesses; } @@ -86,8 +92,9 @@ protected function getLanguagesPriority(array $languagesMap): array { $priority = []; $fallback = []; + $siteAccesses = array_unique(array_merge([$this->siteAccess->name], $this->siteAccesses)); - foreach ($this->siteAccesses as $siteAccess) { + foreach ($siteAccesses as $siteAccess) { $siteAccessLanguages = $this->configResolver->getParameter('languages', null, $siteAccess); $priority[] = array_shift($siteAccessLanguages); $fallback = array_merge($fallback, $siteAccessLanguages); From 82d582bd21e8f1bc66619ed8a94aca093408964d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20D=C4=99bi=C5=84ski?= Date: Thu, 18 Nov 2021 12:15:53 +0100 Subject: [PATCH 2/2] corrected CS --- src/lib/UI/Config/Provider/Languages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/UI/Config/Provider/Languages.php b/src/lib/UI/Config/Provider/Languages.php index 4638c74a09..af77796c63 100644 --- a/src/lib/UI/Config/Provider/Languages.php +++ b/src/lib/UI/Config/Provider/Languages.php @@ -27,7 +27,7 @@ class Languages implements ProviderInterface /** @var string[] */ private $siteAccesses; - /** @var \eZ\Publish\Core\MVC\Symfony\SiteAccess */ + /** @var \eZ\Publish\Core\MVC\Symfony\SiteAccess */ private $siteAccess; /**