PreviewLocaleContext is not applied for ShopSection preview
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
Research direction
Start with the PreviewLocaleContext class, which the issue says throws LocaleNotFoundException when sectionProvider->getSection() is not an AdminSection. Read the live-action check that follows it to see whether it already covers the preview case. Find the existing tests for this context and add one where a ShopSection is active and the locale should resolve. Done when that test passes and the first AdminSection check is either removed or justified in the thread.
Written by the indexing model from the issue text.
Description
On my Sylius application, I created some custom element types that have special rules for anonymous users. I created a custom section provider that provide an instance of ShopSection instead of AdminSection.
But in that cas, the preview feature does not work as expected: the locale selector is not working. I discovered that the PreviewLocaleContext handles the locale for the preview, but the first condition in it is :
if (!$this->sectionProvider->getSection() instanceof AdminSection) {
throw new LocaleNotFoundException();
}
The other condition already check if the current live action is the correct one, so I don't understand why this condition exists.
I tested to patch the bundle by removing this first check and there seems to be no negative impacts.
Thanks for your help !
- Dominant language
- PHP
- Stars
- 18
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Sylius/CmsPlugin
-
TaxonsListContentElementRenderer ignores the configured taxon order and renders disabled taxonsOpen
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
Difficulty 4/5 3-5 days Newbie friendliness 72/100
-
Convert XML services configs to PHPPossibly taken @crydotsnake claimed this 87 days ago. OpenDX Maintenance
-
Feature: copy/paste functionality on blocks and pagesMay be free again @crydotsnake claimed this 100 days ago, and no pull request is open. OpenAdmin Feature UX
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
All issues in Sylius/CmsPlugin
Similar issues
-
Difficulty 2/5 Half a day Newbie friendliness 68/100
components-web-app/docs#244 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
PrestaShopCorp/ps_eventbus#501 · 2 reactions ·
-
category::task maintenance priority::normal
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
e0ipso/schema-forms-php#58 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Automattic/blocks-engine#2866 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
community-scripts/ProxmoxVE#17944 · 1 comment ·
Maintainers usually reply within 1 day