Skip to content

Commit dc951a3

Browse files
authored
Merge pull request #9 from customgento/DEV-244-add-a-new-check
Dev 244 add a new check
2 parents cfc596e + 04a7c19 commit dc951a3

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

Helper/StoreUrl.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace CustomGento\DefaultStoreCodeRemover\Helper;
6+
7+
use Magento\Store\Api\Data\StoreInterface;
8+
use Magento\Store\Model\Store;
9+
use MageWorx\SeoBase\Helper\StoreUrl as MageworxStoreUrl;
10+
11+
class StoreUrl extends MageworxStoreUrl
12+
{
13+
protected function isUseStoreCodeInUrl(StoreInterface $store): bool
14+
{
15+
if ($store->getCode() !== Store::ADMIN_CODE && $store->isDefault()) {
16+
return false;
17+
}
18+
19+
$storeId = (int)$store->getId();
20+
21+
return !($store->hasDisableStoreInUrl() && $store->getDisableStoreInUrl())
22+
&& $this->configDataLoader->getConfigValue(Store::XML_PATH_STORE_IN_URL, $storeId);
23+
}
24+
}

etc/di.xml

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

0 commit comments

Comments
 (0)