/** * Get 'staging' theme * * @return \Magento\Framework\View\Design\ThemeInterface */ public function getStagingTheme() { if (!$this->_stagingTheme) { $this->_stagingTheme = $this->_theme->getStagingVersion(); if (!$this->_stagingTheme) { $this->_stagingTheme = $this->_createStagingTheme(); $this->_themeCopyService->copy($this->_theme, $this->_stagingTheme); } } return $this->_stagingTheme; }
/** * Create theme customization * * @param \Magento\Framework\View\Design\ThemeInterface $theme * @return \Magento\Framework\View\Design\ThemeInterface */ public function createVirtualTheme($theme) { $themeData = $theme->getData(); $themeData['parent_id'] = $theme->getId(); $themeData['theme_id'] = null; $themeData['theme_path'] = null; $themeData['theme_title'] = $this->_getVirtualThemeTitle($theme); $themeData['type'] = \Magento\Framework\View\Design\ThemeInterface::TYPE_VIRTUAL; /** @var $themeCustomization \Magento\Framework\View\Design\ThemeInterface */ $themeCustomization = $this->_themeFactory->create()->setData($themeData); $themeCustomization->getThemeImage()->createPreviewImageCopy($theme); $themeCustomization->save(); $this->_themeCopyService->copy($theme, $themeCustomization); return $themeCustomization; }
/** * Copy changes from 'staging' theme * * @return \Magento\Framework\View\Design\Theme\Domain\StagingInterface */ public function updateFromStagingTheme() { $this->_themeCopyService->copy($this->_theme, $this->_theme->getParentTheme()); return $this; }
/** * Copy all changed data related to launched theme from staging theme * * @return $this */ public function copyChanges() { $this->_copyService->copy($this->getStagingTheme(), $this->getEditableTheme()); return $this; }