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
88 *
99 * @var \Noon\HideDefaultStoreCode\Service\Config
1010 */
11- protected $ config ;
11+ private $ config ;
1212
1313 /**
14- *
15- * @var \Magento\Store\Model\StoreManagerInterface
16- */
17- protected $ storeManager ;
18-
19- /**
20- *
2114 * @param \Noon\HideDefaultStoreCode\Service\Config $config
22- * @param \Magento\Store\Model\StoreManagerInterface $storeManager
2315 */
2416 public function __construct (
25- \Noon \HideDefaultStoreCode \Service \Config $ config ,
26- \Magento \Store \Model \StoreManagerInterface $ storeManager
17+ \Noon \HideDefaultStoreCode \Service \Config $ config
2718 ) {
2819 $ this ->config = $ config ;
29- $ this ->storeManager = $ storeManager ;
3020 }
3121
3222 /**
3323 *
3424 * @param \Magento\Store\Model\Store $subject
35- * @param string $url
36- * @return string
25+ * @param bool $result
26+ * @return bool
3727 */
38- public function afterGetBaseUrl (\Magento \Store \Model \Store $ subject , $ url )
28+ public function afterIsUseStoreInUrl (\Magento \Store \Model \Store $ subject , bool $ result )
3929 {
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 ;
4432 }
45- return $ url ;
33+
34+ return $ result ;
4635 }
4736}
You can’t perform that action at this time.
0 commit comments