forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from magento/2.3-develop
for merge
- Loading branch information
Showing
19 changed files
with
289 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\Store\ViewModel; | ||
|
||
use Magento\Framework\App\ActionInterface; | ||
use Magento\Framework\Url\EncoderInterface; | ||
use Magento\Framework\UrlInterface; | ||
use Magento\Store\Model\Store; | ||
use Magento\Store\Model\StoreManagerInterface; | ||
|
||
/** | ||
* Provides target store redirect url. | ||
*/ | ||
class SwitcherUrlProvider implements \Magento\Framework\View\Element\Block\ArgumentInterface | ||
{ | ||
/** | ||
* @var EncoderInterface | ||
*/ | ||
private $encoder; | ||
|
||
/** | ||
* @var StoreManagerInterface | ||
*/ | ||
private $storeManager; | ||
|
||
/** | ||
* @var UrlInterface | ||
*/ | ||
private $urlBuilder; | ||
|
||
/** | ||
* @param EncoderInterface $encoder | ||
* @param StoreManagerInterface $storeManager | ||
* @param UrlInterface $urlBuilder | ||
*/ | ||
public function __construct( | ||
EncoderInterface $encoder, | ||
StoreManagerInterface $storeManager, | ||
UrlInterface $urlBuilder | ||
) { | ||
$this->encoder = $encoder; | ||
$this->storeManager = $storeManager; | ||
$this->urlBuilder = $urlBuilder; | ||
} | ||
|
||
/** | ||
* Returns target store redirect url. | ||
* | ||
* @param Store $store | ||
* @return string | ||
* @throws \Magento\Framework\Exception\NoSuchEntityException | ||
*/ | ||
public function getTargetStoreRedirectUrl(Store $store): string | ||
{ | ||
return $this->urlBuilder->getUrl( | ||
'stores/store/redirect', | ||
[ | ||
'___store' => $store->getCode(), | ||
'___from_store' => $this->storeManager->getStore()->getCode(), | ||
ActionInterface::PARAM_NAME_URL_ENCODED => $this->encoder->encode( | ||
$store->getCurrentUrl(false) | ||
), | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.