Skip to content

Commit 546c83e

Browse files
authored
Merge pull request #13 from customgento/DEV-362-fix-mageworx-dependency
Fix mageworx dependency, DEV-362
2 parents 1f42ca7 + 7fd5026 commit 546c83e

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

Helper/StoreUrl.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,25 @@
88
use Magento\Store\Model\Store;
99
use MageWorx\SeoBase\Helper\StoreUrl as MageworxStoreUrl;
1010

11-
class StoreUrl extends MageworxStoreUrl
12-
{
13-
protected function isUseStoreCodeInUrl(StoreInterface $store): bool
11+
if (class_exists(MageworxStoreUrl::class)) {
12+
class StoreUrl extends MageworxStoreUrl
1413
{
15-
if ($store->getCode() !== Store::ADMIN_CODE && $store->isDefault()) {
16-
return false;
17-
}
14+
protected function isUseStoreCodeInUrl(StoreInterface $store): bool
15+
{
16+
if ($store->getCode() !== Store::ADMIN_CODE && $store->isDefault()) {
17+
return false;
18+
}
19+
20+
$storeId = (int)$store->getId();
1821

19-
$storeId = (int)$store->getId();
22+
return !($store->hasDisableStoreInUrl() && $store->getDisableStoreInUrl())
23+
// @phpstan-ignore-next-line
24+
&& $this->configDataLoader->getConfigValue(Store::XML_PATH_STORE_IN_URL, $storeId);
25+
}
26+
}
27+
} else {
28+
class StoreUrl
29+
{
2030

21-
return !($store->hasDisableStoreInUrl() && $store->getDisableStoreInUrl())
22-
&& $this->configDataLoader->getConfigValue(Store::XML_PATH_STORE_IN_URL, $storeId);
2331
}
2432
}

etc/di.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
<type name="Magento\Store\Model\Store">
44
<plugin name="hide_default_store_code" type="CustomGento\DefaultStoreCodeRemover\Plugin\Store\HideDefaultStoreCodePlugin"/>
55
</type>
6-
76
<preference for="MageWorx\SeoBase\Helper\StoreUrl" type="CustomGento\DefaultStoreCodeRemover\Helper\StoreUrl"/>
8-
</config>
7+
</config>

0 commit comments

Comments
 (0)