88namespace Magento \PageBuilder \Plugin ;
99
1010use Magento \Catalog \Model \Product ;
11+ use Magento \Framework \App \AreaList ;
12+ use Magento \Framework \App \State ;
13+ use Magento \Framework \Message \ManagerInterface ;
1114use Magento \Framework \Message \MessageInterface ;
1215
1316/**
1619class DesignLoader
1720{
1821 /**
19- * @var \Magento\Framework\View\DesignLoader
22+ * @var ManagerInterface
2023 */
21- private $ designLoader ;
24+ private $ messageManager ;
2225
2326 /**
24- * @var \Magento\Framework\Message\ManagerInterface
27+ * Application arealist
28+ *
29+ * @var AreaList
2530 */
26- private $ messageManager ;
31+ private $ areaList ;
2732
2833 /**
29- * @var \Magento\Framework\App\State
34+ * Application State
35+ *
36+ * @var State
3037 */
3138 private $ appState ;
3239
@@ -36,21 +43,21 @@ class DesignLoader
3643 private $ preview ;
3744
3845 /**
39- * @param \Magento\Framework\View\DesignLoader $designLoader
4046 * @param \Magento\Framework\Message\ManagerInterface $messageManager
4147 * @param \Magento\Framework\App\State $appState
4248 * @param \Magento\PageBuilder\Model\Stage\Preview $preview
49+ * @param AreaList $areaList
4350 */
4451 public function __construct (
45- \Magento \Framework \View \DesignLoader $ designLoader ,
4652 \Magento \Framework \Message \ManagerInterface $ messageManager ,
4753 \Magento \Framework \App \State $ appState ,
48- \Magento \PageBuilder \Model \Stage \Preview $ preview
54+ \Magento \PageBuilder \Model \Stage \Preview $ preview ,
55+ AreaList $ areaList
4956 ) {
50- $ this ->designLoader = $ designLoader ;
5157 $ this ->messageManager = $ messageManager ;
5258 $ this ->appState = $ appState ;
5359 $ this ->preview = $ preview ;
60+ $ this ->areaList = $ areaList ;
5461 }
5562
5663 /**
@@ -84,7 +91,8 @@ public function beforeCreate(
8491 public function loadDesignConfig ()
8592 {
8693 try {
87- $ this ->designLoader ->load ();
94+ $ area = $ this ->areaList ->getArea ($ this ->appState ->getAreaCode ());
95+ $ area ->load (\Magento \Framework \App \Area::PART_DESIGN );
8896 } catch (\Magento \Framework \Exception \LocalizedException $ e ) {
8997 if ($ e ->getPrevious () instanceof \Magento \Framework \Config \Dom \ValidationException) {
9098 /** @var MessageInterface $message */
0 commit comments