/** * Stop environment emulation * * Function restores initial store environment * * @return \Magento\Store\Model\App\Emulation */ public function stopEnvironmentEmulation() { if ($this->initialEnvironmentInfo === null) { return $this; } $this->_restoreInitialInlineTranslation($this->initialEnvironmentInfo->getInitialTranslateInline()); $initialDesign = $this->initialEnvironmentInfo->getInitialDesign(); $this->_restoreInitialDesign($initialDesign); // Current store needs to be changed right before locale change and after design change $this->_storeManager->setCurrentStore($initialDesign['store']); $this->_restoreInitialLocale($this->initialEnvironmentInfo->getInitialLocaleCode(), $initialDesign['area']); $this->initialEnvironmentInfo = null; return $this; }