File tree Expand file tree Collapse file tree 1 file changed +9
-20
lines changed Expand file tree Collapse file tree 1 file changed +9
-20
lines changed Original file line number Diff line number Diff line change @@ -8,40 +8,29 @@ class HideDefaultStoreCode
8
8
*
9
9
* @var \Noon\HideDefaultStoreCode\Service\Config
10
10
*/
11
- protected $ config ;
11
+ private $ config ;
12
12
13
13
/**
14
- *
15
- * @var \Magento\Store\Model\StoreManagerInterface
16
- */
17
- protected $ storeManager ;
18
-
19
- /**
20
- *
21
14
* @param \Noon\HideDefaultStoreCode\Service\Config $config
22
- * @param \Magento\Store\Model\StoreManagerInterface $storeManager
23
15
*/
24
16
public function __construct (
25
- \Noon \HideDefaultStoreCode \Service \Config $ config ,
26
- \Magento \Store \Model \StoreManagerInterface $ storeManager
17
+ \Noon \HideDefaultStoreCode \Service \Config $ config
27
18
) {
28
19
$ this ->config = $ config ;
29
- $ this ->storeManager = $ storeManager ;
30
20
}
31
21
32
22
/**
33
23
*
34
24
* @param \Magento\Store\Model\Store $subject
35
- * @param string $url
36
- * @return string
25
+ * @param bool $result
26
+ * @return bool
37
27
*/
38
- public function afterGetBaseUrl (\Magento \Store \Model \Store $ subject , $ url )
28
+ public function afterIsUseStoreInUrl (\Magento \Store \Model \Store $ subject , bool $ result )
39
29
{
40
- $ websiteId = $ this ->storeManager ->getStore ()->getWebsiteId ();
41
- $ defaultStore = $ this ->storeManager ->getWebsite ($ websiteId )->getDefaultStore ();
42
- if ($ this ->config ->isHideDefaultStoreCode () && !is_null ($ defaultStore )) {
43
- $ url = str_replace ('/ ' . $ defaultStore ->getCode () . '/ ' , '/ ' , $ url );
30
+ if ($ this ->config ->isHideDefaultStoreCode () && $ subject ->getCode () !== \Magento \Store \Model \Store::ADMIN_CODE && $ subject ->isDefault ()) {
31
+ return false ;
44
32
}
45
- return $ url ;
33
+
34
+ return $ result ;
46
35
}
47
36
}
You can’t perform that action at this time.
0 commit comments