-
Notifications
You must be signed in to change notification settings - Fork 111
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: Source locale indicator correction. #840
base: 7
Are you sure you want to change the base?
Conversation
67aeaa6
to
37d1813
Compare
37d1813
to
cd46da8
Compare
cd46da8
to
32a802d
Compare
This is ready for a review @GuySartorelli |
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.
I haven't checked anything beyond what I've requested changes for below, since these changes will require either retargetting the PR or fundamentally changing the approach.
src/Extension/FluentExtension.php
Outdated
* | ||
* @return Locale|null | ||
*/ | ||
public function getSourceLocale() | ||
public function getSourceLocale(?bool $isFrontend = true): ?Locale |
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.
public function getSourceLocale(?bool $isFrontend = true): ?Locale | |
public function getSourceLocale() |
Additional parameters (even optional ones) and explicit typehints cannot be added outside of a major release.
See the definition of public API
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.
If those changes are required, they will need to target 8
so they can be included in the next major release.
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.
I'll see if I can find another way 🤔
Please also avoid |
680d87c
to
fce085f
Compare
New changes added: updated API so they match |
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.
Haven't reviewed properly yet. I'll add this to my list of things to try get to this week unless someone else gets to it before me
// This model requires localisation so fallback of any kind is not allowed | ||
// hence the content can't come from another locale | ||
// We don't have a source locale for such case | ||
if ($inheritanceMode === FluentExtension::INHERITANCE_MODE_EXACT) { |
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.
Looks good! I was trying to remind myself how inheritance worked, but this line seems to obviously fix the issue. We should never care about fallbacks if inheritance is exact mode only.
Can you please update the PR description to give actual step-by-step instructions for how to reproduce this from a fresh installation? Include any code samples for setting configuration, and exact steps required - assume I don't know anything about fluent :p As it stands I'm not really sure what the behaviour was before this PR, what it should be afterward, and how to confirm either of those. |
I've added test setup details into the description of this PR as requested @GuySartorelli |
FIX: Source locale indicator correction.
Description
Source locale detection corrected to take into account locale inheritance settings for a specific model. Impacted methods are only used in the CMS UI to give indication to content authors on what to expect (what is the source locale of the content). Before this change the indicator could be inaccurate in a sense that it would indicate content and there would actually not be any content to display.
This change should have no impact on actual content rendering.
Change-set breakdown
RecordLocale::getSourceLocale()
now takes into account locale inheritance modeFluentExtension::getSourceLocale()
is now only a shorthand method to the above method instead of maintaining its own implementation that doesn't cover all the casesManual testing steps
Most common scenarios:
The source locale indicator should be in line with what is shown on the frontend.
Issues
Pull request checklist