File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,13 @@ public function execute()
98
98
$ resultLayout ->setStatusHeader ($ this ->code , '1.1 ' , $ this ->phrase );
99
99
$ resultLayout ->setHeader ('X-Status ' , $ this ->phrase );
100
100
$ resultLayout ->setAction ($ this ->type );
101
-
101
+ try {
102
+ $ templateName = 'pwa-root ' ;
103
+ $ resultLayout ->setRootTemplate ($ templateName );
104
+ } catch (\Exception $ exception ) {
105
+ throw new \Exception (__ ($ templateName . ' template not found ' ));
106
+ }
107
+
102
108
return $ resultLayout ;
103
109
}
104
110
Original file line number Diff line number Diff line change @@ -86,6 +86,11 @@ class Page extends ExtendedPage
86
86
* @var string;
87
87
*/
88
88
private $ action ;
89
+
90
+ /**
91
+ * @var array;
92
+ */
93
+ private $ rootTemplatePool ;
89
94
/**
90
95
* Constructor
91
96
*
@@ -101,6 +106,7 @@ class Page extends ExtendedPage
101
106
* @param bool $isIsolated
102
107
* @param View\EntitySpecificHandlesList $entitySpecificHandlesList
103
108
* @param string $action
109
+ * @param array $rootTemplatePool
104
110
*
105
111
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
106
112
*/
@@ -116,7 +122,8 @@ public function __construct(
116
122
$ template ,
117
123
$ isIsolated = false ,
118
124
View \EntitySpecificHandlesList $ entitySpecificHandlesList = null ,
119
- $ action = null
125
+ $ action = null ,
126
+ $ rootTemplatePool = []
120
127
) {
121
128
parent ::__construct (
122
129
$ context ,
@@ -132,6 +139,7 @@ public function __construct(
132
139
$ entitySpecificHandlesList
133
140
);
134
141
$ this ->action = $ action ;
142
+ $ this ->rootTemplatePool = $ rootTemplatePool ;
135
143
}
136
144
137
145
/**
@@ -159,5 +167,20 @@ public function getAction()
159
167
{
160
168
return $ this ->action ;
161
169
}
170
+
171
+ /**
172
+ * @param string $template
173
+ * @return Page
174
+ * @throws Framework\Exception\LocalizedException
175
+ */
176
+ public function setRootTemplate ($ template )
177
+ {
178
+ if (in_array ($ template , array_keys ($ this ->rootTemplatePool ))) {
179
+ $ this ->template = $ this ->rootTemplatePool [$ template ];
180
+ } else {
181
+ throw new Framework \Exception \LocalizedException (__ ('Invalid root template specified ' ));
182
+ }
183
+ return $ this ;
184
+ }
162
185
163
186
}
Original file line number Diff line number Diff line change 37
37
</argument >
38
38
</arguments >
39
39
</virtualType >
40
+ <type name =" ScandiPWA\Customization\View\Result\Page" >
41
+ <arguments >
42
+ <argument name =" rootTemplatePool" xsi : type =" array" >
43
+ <item name =" pwa-root" xsi : type =" string" >Magento_Theme::scandipwa_root.phtml</item >
44
+ </argument >
45
+ </arguments >
46
+ </type >
40
47
</config >
You can’t perform that action at this time.
0 commit comments