-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix use of the correct localizations with multiple portals #636
Fix use of the correct localizations with multiple portals #636
Conversation
@@ -138,11 +138,18 @@ public function addUrlsOnPostSerialize(ObjectEvent $event): void | |||
return; | |||
} | |||
|
|||
if (null !== ($portal = $attributes->getAttribute('portal'))) { | |||
$allLocalizations = $portal->getLocalizations(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this case seems to miss here also in sulu core: https://github.com/sulu/sulu/blob/b378ec72f296afedbf913967e5e66604737f4b48/src/Sulu/Bundle/WebsiteBundle/Resolver/TemplateAttributeResolver.php#L100
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.
9201576
to
6676e17
Compare
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.
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.
After this change, only localizations of the active portal are returned if you have multiple portals.
Also, the
country
key was added to match the output of pages.