Skip to content

Commit

Permalink
Merge pull request #9 from customgento/DEV-244-add-a-new-check
Browse files Browse the repository at this point in the history
Dev 244 add a new check
  • Loading branch information
iranimij authored Jan 26, 2024
2 parents cfc596e + 04a7c19 commit dc951a3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
24 changes: 24 additions & 0 deletions Helper/StoreUrl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace CustomGento\DefaultStoreCodeRemover\Helper;

use Magento\Store\Api\Data\StoreInterface;
use Magento\Store\Model\Store;
use MageWorx\SeoBase\Helper\StoreUrl as MageworxStoreUrl;

class StoreUrl extends MageworxStoreUrl
{
protected function isUseStoreCodeInUrl(StoreInterface $store): bool
{
if ($store->getCode() !== Store::ADMIN_CODE && $store->isDefault()) {
return false;
}

$storeId = (int)$store->getId();

return !($store->hasDisableStoreInUrl() && $store->getDisableStoreInUrl())
&& $this->configDataLoader->getConfigValue(Store::XML_PATH_STORE_IN_URL, $storeId);
}
}
4 changes: 3 additions & 1 deletion etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
<type name="Magento\Store\Model\Store">
<plugin name="hide_default_store_code" type="CustomGento\DefaultStoreCodeRemover\Plugin\Store\HideDefaultStoreCodePlugin"/>
</type>
</config>

<preference for="MageWorx\SeoBase\Helper\StoreUrl" type="CustomGento\DefaultStoreCodeRemover\Helper\StoreUrl"/>
</config>

0 comments on commit dc951a3

Please sign in to comment.