Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix use of the correct localizations with multiple portals #636

Merged

Conversation

mario-fehr
Copy link
Contributor

@mario-fehr mario-fehr commented Mar 24, 2023

Use the correct localizations of the portal if multiple portals are configured and ´country´ key to the localizations array to match it with the other implementations in sulu.

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets fixes #issuenum
Related issues/PRs #issuenum
License MIT

What's in this PR?

This fixes an issue with localizations when you split them in multiple portals.

Why?

Before this change all localizations of a webspace were returned even if you had separated them in multiple portals.

image

After this change, only localizations of the active portal are returned if you have multiple portals.

image

Also, the country key was added to match the output of pages.

@@ -138,11 +138,18 @@ public function addUrlsOnPostSerialize(ObjectEvent $event): void
return;
}

if (null !== ($portal = $attributes->getAttribute('portal'))) {
$allLocalizations = $portal->getLocalizations();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chirimoya we need to discuss this behaviour.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent to the pages and sulu core I'm fine to merge this currently this way.
Still it currently would not be possible to switch to other portals. My personally opinion would output always all localizations and give a hint also in which portals that locales appear.

@@ -160,6 +167,7 @@ public function addUrlsOnPostSerialize(ObjectEvent $event): void
$localizations[$locale] = [
'locale' => $locale,
'url' => $this->webspaceManager->findUrlByResourceLocator($path, null, $locale),
'country' => $localization->getCountry(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexander-schranz alexander-schranz changed the base branch from 2.4 to 2.5 August 8, 2023 09:44
Use the correct localizations of the portal if multiple portals are configured and ´country´ key to the localizations array to match it with the other implementations in sulu.
@alexander-schranz alexander-schranz added the bug Error or unexpected behavior of already existing functionality label Aug 8, 2023
@alexander-schranz alexander-schranz force-pushed the bugfix/fix-portal-localizations-reslove branch from 9201576 to 6676e17 Compare August 8, 2023 09:44
@alexander-schranz alexander-schranz merged commit a591b2e into sulu:2.5 Aug 8, 2023
6 checks passed
wachterjohannes pushed a commit to wachterjohannes/SuluArticleBundle that referenced this pull request Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Error or unexpected behavior of already existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants