forked from shopware/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEXT-4137 - ignore themeplugins if the current saleschannel dont
have this theme activated - also added new themeplugin bundleclass for themerelated plugins
- Loading branch information
1 parent
49941c6
commit 7f0b4a4
Showing
6 changed files
with
114 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
Framework/Routing/Event/SalesChannelContextResolvedEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Shopware\Core\Framework\Routing\Event; | ||
|
||
use Shopware\Core\System\SalesChannel\SalesChannelContext; | ||
use Symfony\Contracts\EventDispatcher\Event; | ||
|
||
class SalesChannelContextResolvedEvent extends Event | ||
{ | ||
/** | ||
* @var SalesChannelContext | ||
*/ | ||
private $salesChannelContext; | ||
|
||
public function __construct(SalesChannelContext $salesChannelContext) | ||
{ | ||
$this->salesChannelContext = $salesChannelContext; | ||
} | ||
|
||
public function getSalesChannelContext(): SalesChannelContext | ||
{ | ||
return $this->salesChannelContext; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
Framework/Routing/Subscriber/SalesChannelContextResolvedSubscriber.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Shopware\Core\Framework\Routing\Subscriber; | ||
|
||
use Shopware\Core\Framework\Routing\Event\SalesChannelContextResolvedEvent; | ||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
use Twig\Environment; | ||
|
||
class SalesChannelContextResolvedSubscriber implements EventSubscriberInterface | ||
{ | ||
/** | ||
* @var Environment | ||
*/ | ||
private $twig; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $cacheDir; | ||
|
||
public function __construct( | ||
Environment $twig, | ||
string $cacheDir | ||
) { | ||
$this->twig = $twig; | ||
$this->cacheDir = $cacheDir; | ||
} | ||
|
||
public static function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
SalesChannelContextResolvedEvent::class => [ | ||
['resolved'], | ||
], | ||
]; | ||
} | ||
|
||
public function resolved(SalesChannelContextResolvedEvent $event): void | ||
{ | ||
// Set individual saleschannel twig cache | ||
$this->twig->setCache( | ||
$this->cacheDir . '/' | ||
. $event->getSalesChannelContext()->getSalesChannel()->getId() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters