urlHelper = $urlHelper; $this->session = $session; $this->sidResolver = $sidResolver; } /** * @param StoreInterface $fromStore store where we came from * @param StoreInterface $targetStore store where to go to * @param string $redirectUrl original url requested for redirect after switching * @return string redirect url */ public function switch(StoreInterface $fromStore, StoreInterface $targetStore, string $redirectUrl): string { $targetUrl = $redirectUrl; $sidName = $this->sidResolver->getSessionIdQueryParam($this->session); $targetUrl = $this->urlHelper->removeRequestParam($targetUrl, $sidName); $targetUrl = $this->urlHelper->removeRequestParam($targetUrl, '___from_store'); $targetUrl = $this->urlHelper->removeRequestParam($targetUrl, StoreResolverInterface::PARAM_NAME); return $targetUrl; } }