Skip to content

Commit 661bdd4

Browse files
committed
Force Loki Theme Kit upon Luma as soon as LokiTheme_LumaComponents as enabled
1 parent 2596fbe commit 661bdd4

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

Config/RequestConfig.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace LokiTheme\LumaComponents\Config;
5+
6+
use Magento\Framework\App\Request\Http as HttpRequest;
7+
8+
class RequestConfig
9+
{
10+
public function __construct(
11+
private HttpRequest $httpRequest,
12+
private array $allowedRoutes = []
13+
) {
14+
}
15+
16+
public function allowRoute(): bool
17+
{
18+
if (in_array($this->getCurrentUri(), $this->allowedRoutes)) {
19+
return true;
20+
}
21+
22+
return false;
23+
}
24+
25+
private function getCurrentUri(): string
26+
{
27+
return implode('/', [
28+
$this->httpRequest->getRouteName(),
29+
$this->httpRequest->getControllerName(),
30+
$this->httpRequest->getActionName(),
31+
]);
32+
}
33+
}

Observer/RemoveLegacyHtmlBindings.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace LokiTheme\LumaComponents\Observer;
44

5+
use LokiTheme\LumaComponents\Config\RequestConfig;
56
use LokiTheme\LumaComponents\Config\ThemeConfig;
67
use Magento\Framework\Event\Observer;
78
use Magento\Framework\Event\ObserverInterface;
@@ -10,13 +11,14 @@ class RemoveLegacyHtmlBindings implements ObserverInterface
1011
{
1112
public function __construct(
1213
private readonly ThemeConfig $themeConfig,
14+
private readonly RequestConfig $requestConfig,
1315
private array $patterns = [],
1416
) {
1517
}
1618

1719
public function execute(Observer $observer): void
1820
{
19-
if (false === $this->themeConfig->modifyCurrentTheme()) {
21+
if (false === $this->themeConfig->modifyCurrentTheme() && false === $this->requestConfig->allowRoute()) {
2022
return;
2123
}
2224

0 commit comments

Comments
 (0)