9
9
use Magento \Framework \App \ObjectManager ;
10
10
use Magento \Framework \Serialize \SerializerInterface ;
11
11
use Magento \Framework \Serialize \Serializer \Json ;
12
+ use Magento \Framework \View \DesignInterface ;
12
13
13
14
/**
14
15
* View configuration files handler
@@ -44,6 +45,11 @@ class View extends \Magento\Framework\Config\Reader\Filesystem
44
45
*/
45
46
private $ scopedLayoutCache ;
46
47
48
+ /**
49
+ * @var DesignInterface
50
+ */
51
+ private $ design ;
52
+
47
53
/**
48
54
* @param FileResolverInterface $fileResolver
49
55
* @param ConverterInterface $converter
@@ -56,6 +62,7 @@ class View extends \Magento\Framework\Config\Reader\Filesystem
56
62
* @param array $xpath
57
63
* @param LayoutCache|null $layoutCache
58
64
* @param SerializerInterface|null $serializer
65
+ * @param DesignInterface|null $design
59
66
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
60
67
*/
61
68
public function __construct (
@@ -69,7 +76,8 @@ public function __construct(
69
76
$ defaultScope = 'global ' ,
70
77
$ xpath = [],
71
78
LayoutCache $ layoutCache = null ,
72
- SerializerInterface $ serializer = null
79
+ SerializerInterface $ serializer = null ,
80
+ DesignInterface $ design = null
73
81
) {
74
82
$ this ->xpath = $ xpath ;
75
83
$ idAttributes = $ this ->getIdAttributes ();
@@ -86,6 +94,7 @@ public function __construct(
86
94
);
87
95
$ this ->layoutCache = $ layoutCache ?? ObjectManager::getInstance ()->get (LayoutCache::class);
88
96
$ this ->serializer = $ serializer ?? ObjectManager::getInstance ()->get (Json::class);
97
+ $ this ->design = $ design ?? ObjectManager::getInstance ()->get (DesignInterface::class);
89
98
}
90
99
91
100
/**
@@ -235,7 +244,7 @@ protected function initData()
235
244
public function read ($ scope = null )
236
245
{
237
246
$ scope = $ scope ?: $ this ->_defaultScope ;
238
- $ layoutCacheKey = __CLASS__ . '- ' . $ scope . '- ' . $ this ->_fileName ;
247
+ $ layoutCacheKey = __CLASS__ . '- ' . $ scope . '- ' . $ this ->_fileName . ' - ' . $ this -> design -> getArea () ;
239
248
if (!isset ($ this ->scopedLayoutCache [$ layoutCacheKey ])) {
240
249
if ($ data = $ this ->layoutCache ->load ($ layoutCacheKey )) {
241
250
$ this ->scopedLayoutCache [$ layoutCacheKey ] = $ this ->serializer ->unserialize ($ data );
0 commit comments