File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 22
33namespace LokiTheme \LumaComponents \Observer ;
44
5+ use LokiTheme \LumaComponents \Config \RequestConfig ;
56use LokiTheme \LumaComponents \Config \ThemeConfig ;
67use Magento \Framework \Event \Observer ;
78use 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
You can’t perform that action at this time.
0 commit comments