8000 Set _locale when handling slug route by lukadschaak · Pull Request #11647 · pimcore/pimcore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Set _locale when handling slug route #11647

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

Closed
wants to merge 2 commits into from
Closed

Set _locale when handling slug route #11647

wants to merge 2 commits into from

Conversation

lukadschaak
Copy link
Contributor

Changes in this pull request and Additional info

When processing a DataObject with a slugged route, AND the route contains a locale part, then the locale is never processed.

This PR add's some funtionality, like the \Pimcore\Model\Staticroute::match() does. If a static route has a _locale parameter and a proper pattern given, it will be resolved. This PR looks anly at the first part of the path of the url and uses it as _locale

Maybe the static route mechanism would make sense for slugs too, but this is out of my scope.

@CLAassistant
Copy link
CLAassistant commented Mar 11, 2022

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@dpfaffenbauer
Copy link
Contributor

This doesn't feel right either... Pimcore knows from the slug field (inside the localized-field) what locale a certain slug should serve the content in. So Localization isn't properly thought about with slugs I guess? @brusch?

@lukadschaak
Copy link
Contributor Author

Ah, what it see know is: Slug has a db field named position, which can be read by $slug->getPosition() and it contains the language key like de or en. Is this the language from the localized field? Than this would be a one liner.

@brusch
Copy link
Member
brusch commented Mar 11, 2022

Well yes, this is probably something we can think about but this proposed solution in this PR is not generic enought, because it assumes to have the locale in the first part of the path info.
I think the best solution would be to set _locale accordingly when the matching slug is inside a localized field - that would be the intentional behavior.

@brusch
Copy link
Member
brusch commented Mar 11, 2022

@lukadschaak oh, I was a bit too late - but same idea ☺️
Created already a follow-up PR: #11649

@lukadschaak
Copy link
Contributor Author

Nice! Thanks a lot 👍

@lukadschaak lukadschaak deleted the patch-1 branch March 11, 2022 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0