Example #1
0
 /**
  * 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;
 }
Example #2
0
 /**
  * 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;
 }
Example #3
0
 public function testCopyChanges()
 {
     $this->_setEditableTheme();
     $themeObject = $this->_setStagingTheme();
     $this->_copyService->expects($this->atLeastOnce())->method('copy')->with($this->equalTo($themeObject), $this->equalTo($this->_theme))->will($this->returnSelf());
     $this->assertEquals($this->_model, $this->_model->copyChanges());
 }
Example #4
0
 /**
  * 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;
 }
Example #5
0
 /**
  * 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;
 }