Skip to content
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

doc: Update "Your first theme" documentation #129

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions docs/your_first_theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ When adding or removing a theme, it's necessary to rebuild the container (same a

### Theme structure

Themes can override and add both bundle resources and app resources. When your theme configuration is in `SampleTheme/theme.json`,
Themes can override and add both bundle resources and app resources. When your theme configuration is in `SampleTheme/composer.json`,
app resources should be located at `SampleTheme/templates` for templates, `SampleTheme/translations` for translations and `SampleTheme/public` for assets.
To override a specific bundle's template (eg. `FOSUserBundle`), put it in `SampleTheme/templates/bundles/FOSUserBundle` directory.

Expand Down Expand Up @@ -65,9 +65,13 @@ Create an event listener and register it as listening for `kernel.request` event
```php
use Sylius\Bundle\ThemeBundle\Context\SettableThemeContext;
use Sylius\Bundle\ThemeBundle\Repository\ThemeRepositoryInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;

#[AsEventListener(
event: RequestEvent::class,
)]
final class ThemeRequestListener
{
/** @var ThemeRepositoryInterface */
Expand All @@ -82,7 +86,7 @@ final class ThemeRequestListener
$this->themeContext = $themeContext;
}

public function onKernelRequest(GetResponseEvent $event): void
public function onKernelRequest(RequestEvent $event): void
{
if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
// don't do anything if it's not the master request
Expand Down