This repository has been archived by the owner on Dec 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
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 #3 from magento/2.3-develop
merge latest changes
- Loading branch information
Showing
22 changed files
with
297 additions
and
113 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.