Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getThemeCustomizations($area = \Magento\Framework\App\Area::AREA_FRONTEND, $type = \Magento\Framework\View\Design\ThemeInterface::TYPE_VIRTUAL)
 {
     /** @var $themeCollection \Magento\Core\Model\Resource\Theme\Collection */
     $themeCollection = $this->collectionFactory->create();
     $themeCollection->addAreaFilter($area)->addTypeFilter($type);
     return $themeCollection;
 }
Exemplo n.º 2
0
 /**
  * Retrieve instance of a theme currently used in an area
  *
  * @return \Magento\Framework\View\Design\ThemeInterface
  */
 public function get()
 {
     $area = $this->appState->getAreaCode();
     if ($this->design->getDesignTheme()->getArea() == $area || $this->design->getArea() == $area) {
         return $this->design->getDesignTheme();
     }
     /** @var \Magento\Core\Model\Resource\Theme\Collection $themeCollection */
     $themeCollection = $this->themeFactory->create();
     $themeIdentifier = $this->design->getConfigurationDesignTheme($area);
     if (is_numeric($themeIdentifier)) {
         $result = $themeCollection->getItemById($themeIdentifier);
     } else {
         $themeFullPath = $area . \Magento\Framework\View\Design\ThemeInterface::PATH_SEPARATOR . $themeIdentifier;
         $result = $themeCollection->getThemeByFullPath($themeFullPath);
     }
     return $result;
 }
Exemplo n.º 3
0
 public function testGetByAreaWithOtherAreaAndNumericThemeId()
 {
     $this->designMock->expects($this->once())->method('getDesignTheme')->will($this->returnValue($this->themeMock));
     $this->designMock->expects($this->once())->method('getArea')->will($this->returnValue('design_area'));
     $this->designMock->expects($this->once())->method('getConfigurationDesignTheme')->will($this->returnValue(12));
     $this->themeMock->expects($this->once())->method('getArea')->will($this->returnValue('theme_area'));
     $this->themeCollectionFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->themeCollectionMock));
     $this->themeCollectionMock->expects($this->once())->method('getItemById')->with(12)->will($this->returnValue($this->themeMock));
     $this->appStateMock->expects($this->once())->method('getAreaCode')->will($this->returnValue('other_area'));
     $this->assertEquals($this->themeMock, $this->model->get());
 }
Exemplo n.º 4
0
 /**
  * Retrieve theme instance by its identifier
  *
  * @param int $themeId
  * @return \Magento\Core\Model\Theme|null
  */
 protected function _getThemeInstance($themeId)
 {
     /** @var \Magento\Core\Model\Resource\Theme\Collection $themeCollection */
     $themeCollection = $this->_themesFactory->create();
     return $themeCollection->getItemById($themeId);
 }
Exemplo n.º 5
0
 /**
  * @return \Magento\Core\Model\Resource\Theme\CollectionFactory
  */
 public function createThemeResourceFactory()
 {
     return $this->_themeResourceFactory->create();
 }