99
1010use Magento \Catalog \Model \Product ;
1111use Magento \Framework \Message \MessageInterface ;
12- use Magento \Framework \View \DesignLoader as ViewDesignLoader ;
1312use Magento \Framework \Message \ManagerInterface ;
1413use Magento \Catalog \Block \Product \ImageFactory ;
14+ use Magento \Framework \App \AreaList ;
15+ use Magento \Framework \App \State ;
1516
1617/**
1718 * Load necessary design files for GraphQL
1819 */
1920class DesignLoader
2021{
2122 /**
22- * @var DesignLoader
23+ * @var ManagerInterface
2324 */
24- private $ designLoader ;
25+ private $ messageManager ;
2526
2627 /**
27- * @var ManagerInterface
28+ * Application arealist
29+ *
30+ * @var AreaList
2831 */
29- private $ messageManager ;
32+ private $ areaList ;
33+
34+ /**
35+ * Application State
36+ *
37+ * @var State
38+ */
39+ private $ appState ;
3040
3141 /**
32- * @param ViewDesignLoader $designLoader
3342 * @param ManagerInterface $messageManager
43+ * @param AreaList $areaList
44+ * @param State $appState
3445 */
3546 public function __construct (
36- ViewDesignLoader $ designLoader ,
37- ManagerInterface $ messageManager
47+ ManagerInterface $ messageManager ,
48+ AreaList $ areaList ,
49+ State $ appState
3850 ) {
39- $ this ->designLoader = $ designLoader ;
4051 $ this ->messageManager = $ messageManager ;
52+ $ this ->areaList = $ areaList ;
53+ $ this ->appState = $ appState ;
4154 }
4255
4356 /**
@@ -57,7 +70,8 @@ public function beforeCreate(
5770 array $ attributes = null
5871 ) {
5972 try {
60- $ this ->designLoader ->load ();
73+ $ area = $ this ->areaList ->getArea ($ this ->appState ->getAreaCode ());
74+ $ area ->load (\Magento \Framework \App \Area::PART_DESIGN );
6175 } catch (\Magento \Framework \Exception \LocalizedException $ e ) {
6276 if ($ e ->getPrevious () instanceof \Magento \Framework \Config \Dom \ValidationException) {
6377 /** @var MessageInterface $message */
0 commit comments