8
8
namespace Magento \PageBuilder \Plugin ;
9
9
10
10
use Magento \Catalog \Model \Product ;
11
+ use Magento \Framework \App \AreaList ;
12
+ use Magento \Framework \App \State ;
13
+ use Magento \Framework \Message \ManagerInterface ;
11
14
use Magento \Framework \Message \MessageInterface ;
12
15
13
16
/**
@@ -21,14 +24,23 @@ class DesignLoader
21
24
private $ designLoader ;
22
25
23
26
/**
24
- * @var \Magento\Framework\Message\ ManagerInterface
27
+ * @var ManagerInterface
25
28
*/
26
- private $ messageManager ;
29
+ private ManagerInterface $ messageManager ;
27
30
28
31
/**
29
- * @var \Magento\Framework\App\State
32
+ * Application
33
+ *
34
+ * @var AreaList
35
+ */
36
+ private AreaList $ areaList ;
37
+
38
+ /**
39
+ * Layout
40
+ *
41
+ * @var State
30
42
*/
31
- private $ appState ;
43
+ private State $ appState ;
32
44
33
45
/**
34
46
* @var \Magento\PageBuilder\Model\Stage\Preview
@@ -40,17 +52,20 @@ class DesignLoader
40
52
* @param \Magento\Framework\Message\ManagerInterface $messageManager
41
53
* @param \Magento\Framework\App\State $appState
42
54
* @param \Magento\PageBuilder\Model\Stage\Preview $preview
55
+ * @param AreaList $areaList
43
56
*/
44
57
public function __construct (
45
58
\Magento \Framework \View \DesignLoader $ designLoader ,
46
59
\Magento \Framework \Message \ManagerInterface $ messageManager ,
47
60
\Magento \Framework \App \State $ appState ,
48
- \Magento \PageBuilder \Model \Stage \Preview $ preview
61
+ \Magento \PageBuilder \Model \Stage \Preview $ preview ,
62
+ AreaList $ areaList ,
49
63
) {
50
64
$ this ->designLoader = $ designLoader ;
51
65
$ this ->messageManager = $ messageManager ;
52
66
$ this ->appState = $ appState ;
53
67
$ this ->preview = $ preview ;
68
+ $ this ->areaList = $ areaList ;
54
69
}
55
70
56
71
/**
@@ -84,7 +99,8 @@ public function beforeCreate(
84
99
public function loadDesignConfig ()
85
100
{
86
101
try {
87
- $ this ->designLoader ->load ();
102
+ $ area = $ this ->areaList ->getArea ($ this ->appState ->getAreaCode ());
103
+ $ area ->load (\Magento \Framework \App \Area::PART_DESIGN );
88
104
} catch (\Magento \Framework \Exception \LocalizedException $ e ) {
89
105
if ($ e ->getPrevious () instanceof \Magento \Framework \Config \Dom \ValidationException) {
90
106
/** @var MessageInterface $message */
0 commit comments