Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

PreviewLocaleContext is not applied for ShopSection preview

Open Beginner friendly
#215 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
php
Domain
backend

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Sylius/CmsPlugin

All issues in Sylius/CmsPlugin

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.