/** * 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\Theme\Model\ResourceModel\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; }
/** * @param Reader $moduleReader * @param FileIteratorFactory $iteratorFactory * @param DesignInterface $designInterface * @param DirectoryList $directoryList * @param Filesystem $filesystem * @param ResolverInterface $resolver */ public function __construct(Reader $moduleReader, FileIteratorFactory $iteratorFactory, DesignInterface $designInterface, DirectoryList $directoryList, Filesystem $filesystem, ResolverInterface $resolver) { $this->directoryList = $directoryList; $this->iteratorFactory = $iteratorFactory; $this->moduleReader = $moduleReader; $this->currentTheme = $designInterface->getDesignTheme(); $this->area = $designInterface->getArea(); $this->rootDirectory = $filesystem->getDirectoryRead(DirectoryList::ROOT); $this->resolver = $resolver; }
/** * Retrieve inline script code * * Create block to render script and html with * added inline translation content specific for vde. * * @return string */ protected function getInlineScript() { /** @var $block \Magento\Framework\View\Element\Template */ $block = $this->_objectManager->create('Magento\\Framework\\View\\Element\\Template'); $block->setArea($this->_design->getArea()); $block->setAjaxUrl($this->_getAjaxUrl()); $block->setFrameUrl($this->_getFrameUrl()); $block->setRefreshCanvas($this->isAllowed()); $block->setTemplate('Magento_DesignEditor::translate_inline.phtml'); $block->setTranslateMode($this->_helper->getTranslationMode()); return $block->toHtml(); }
/** * Get design configuration data * * @return \Magento\Framework\Object */ public function getDesignConfig() { if ($this->_designConfig === null) { if ($this->_area === null) { $this->_area = $this->_design->getArea(); } if ($this->_store === null) { $this->_store = $this->_storeManager->getStore()->getId(); } $this->_designConfig = new \Magento\Framework\Object(array('area' => $this->_area, 'store' => $this->_store)); } return $this->_designConfig; }
/** * @param Reader $moduleReader * @param FileIteratorFactory $iteratorFactory * @param DesignInterface $designInterface * @param DirectoryList $directoryList * @param Filesystem $filesystem * @param ComponentRegistrar $componentRegistrar */ public function __construct( Reader $moduleReader, FileIteratorFactory $iteratorFactory, DesignInterface $designInterface, DirectoryList $directoryList, Filesystem $filesystem, ComponentRegistrar $componentRegistrar ) { $this->directoryList = $directoryList; $this->iteratorFactory = $iteratorFactory; $this->moduleReader = $moduleReader; $this->currentTheme = $designInterface->getDesignTheme(); $this->themePath = $designInterface->getThemePath($this->currentTheme); $this->area = $designInterface->getArea(); $this->rootDirectory = $filesystem->getDirectoryRead(DirectoryList::ROOT); $this->componentRegistrar = $componentRegistrar; }
/** * Get design configuration data * * @return DataObject */ public function getDesignConfig() { if ($this->designConfig === null) { if ($this->area === null) { $this->area = $this->design->getArea(); } if ($this->store === null) { $this->store = $this->storeManager->getStore()->getId(); } $this->designConfig = new DataObject(['area' => $this->area, 'store' => $this->store]); } return $this->designConfig; }
public function testSetGetArea() { $this->assertEquals(\Magento\Framework\View\DesignInterface::DEFAULT_AREA, $this->_model->getArea()); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\App\\State')->setAreaCode('test'); $this->assertEquals('test', $this->_model->getArea()); }