Skip to content

Commit 0117201

Browse files
authored
Merge pull request #7674 from magento-arcticfoxes/B2B-2221
B2B-2221: Magento\CatalogGraphQl\Plugin\DesignLoader plugin loads too…
2 parents 09c80c7 + 2d2e3e0 commit 0117201

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

app/code/Magento/CatalogGraphQl/Plugin/DesignLoader.php

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,48 @@
99

1010
use Magento\Catalog\Model\Product;
1111
use Magento\Framework\Message\MessageInterface;
12-
use Magento\Framework\View\DesignLoader as ViewDesignLoader;
1312
use Magento\Framework\Message\ManagerInterface;
1413
use 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
*/
1920
class 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

Comments
 (0)