27
27
use Magento \Store \Model \ScopeInterface ;
28
28
use Magento \Store \Model \StoreManagerInterface ;
29
29
use ScandiPWA \Locale \View \Result \Page as LocalePage ;
30
+ use Magento \Framework \Serialize \Serializer \Json ;
31
+
30
32
31
33
/**
32
34
* Class Page
@@ -44,6 +46,11 @@ class Page extends LocalePage
44
46
*/
45
47
protected $ storeManager ;
46
48
49
+ /**
50
+ * @var Json
51
+ */
52
+ protected $ json ;
53
+
47
54
/**
48
55
* Page constructor.
49
56
* @param StoreManagerInterface $storeManager
@@ -56,6 +63,7 @@ class Page extends LocalePage
56
63
* @param GeneratorPool $generatorPool
57
64
* @param RendererFactory $pageConfigRendererFactory
58
65
* @param Reader $pageLayoutReader
66
+ * @param Json $json
59
67
* @param string $template
60
68
* @param bool $isIsolated
61
69
* @param EntitySpecificHandlesList|null $entitySpecificHandlesList
@@ -72,13 +80,15 @@ public function __construct(
72
80
GeneratorPool $ generatorPool ,
73
81
RendererFactory $ pageConfigRendererFactory ,
74
82
Reader $ pageLayoutReader ,
83
+ Json $ json ,
75
84
string $ template ,
76
85
$ isIsolated = false ,
77
86
EntitySpecificHandlesList $ entitySpecificHandlesList = null ,
78
87
$ action = null
79
88
) {
80
89
$ this ->scopeConfig = $ context ->getScopeConfig ();
81
90
$ this ->storeManager = $ storeManager ;
91
+ $ this ->json = $ json ;
82
92
83
93
parent ::__construct (
84
94
$ localeResolver ,
@@ -112,4 +122,21 @@ public function getThemeConfiguration(
112
122
$ this ->storeManager ->getStore ()->getId ()
113
123
);
114
124
}
125
+
126
+ /**
127
+ * Get store list json
128
+ *
129
+ * @return bool|false|string
130
+ */
131
+ public function getStoreListJson ()
132
+ {
133
+ $ result = [];
134
+ $ storeList = $ this ->storeManager ->getStores ();
135
+
136
+ foreach ($ storeList as $ store ) {
137
+ $ result [] = $ store ->getCode ();
138
+ }
139
+
140
+ return $ this ->json ->serialize ($ result );
141
+ }
115
142
}
0 commit comments