/** * Retrieve files * * Aggregate layout files from modules and a theme and its ancestors * * @param ThemeInterface $theme * @param string $filePath * @return \Magento\Framework\View\File[] */ public function getFiles(ThemeInterface $theme, $filePath) { $list = $this->fileListFactory->create(); $list->add($this->baseFiles->getFiles($theme, $filePath)); foreach ($theme->getInheritedThemes() as $currentTheme) { $list->add($this->themeFiles->getFiles($currentTheme, $filePath)); $list->replace($this->overrideBaseFiles->getFiles($currentTheme, $filePath)); $list->replace($this->overrideThemeFiles->getFiles($currentTheme, $filePath)); } return $list->getAll(); }
/** * Retrieve files * * @param ThemeInterface $theme * @param string $filePath * @return array|\Magento\Framework\View\File[] */ public function getFiles(ThemeInterface $theme, $filePath) { $list = $this->fileListFactory->create(); $files = $this->libraryDirectory->search($filePath); $list->add($this->createFiles($this->libraryDirectory, $theme, $files)); foreach ($theme->getInheritedThemes() as $currentTheme) { $themeFullPath = $currentTheme->getFullPath(); $files = $this->themesDirectory->search("{$themeFullPath}/web/{$filePath}"); $list->replace($this->createFiles($this->themesDirectory, $theme, $files), false); } return $list->getAll(); }
/** * Retrieve files * * @param ThemeInterface $theme * @param string $filePath * @return array|\Magento\Framework\View\File[] */ public function getFiles(ThemeInterface $theme, $filePath) { $list = $this->fileListFactory->create('Magento\\Framework\\Less\\File\\FileList\\Collator'); $files = $this->libraryDirectory->search($filePath); $list->add($this->createFiles($this->libraryDirectory, $theme, $files)); foreach ($theme->getInheritedThemes() as $currentTheme) { $themeFullPath = $currentTheme->getFullPath(); $files = $this->rootDirectory->search("web/{$filePath}", $this->themeDir->getPathByKey($themeFullPath)); //$files = $this->themesDirectory->search("{$themeFullPath}/web/{$filePath}"); $list->replace($this->createFiles($this->themesDirectory, $theme, $files), false); } return $list->getAll(); }
/** * Retrieve files * * Aggregate source files from modules and a theme and its ancestors * * @param \Magento\Framework\View\Design\ThemeInterface $theme * @param string $filePath * @return \Magento\Framework\View\File[] * @throws \LogicException */ public function getFiles(ThemeInterface $theme, $filePath) { $list = $this->fileListFactory->create('Magento\\Framework\\Css\\PreProcessor\\File\\FileList\\Collator'); $list->add($this->libraryFiles->getFiles($theme, $filePath)); $list->add($this->baseFiles->getFiles($theme, $filePath)); foreach ($theme->getInheritedThemes() as $currentTheme) { $files = $this->overriddenBaseFiles->getFiles($currentTheme, $filePath); $list->replace($files); } $result = $list->getAll(); if (empty($result)) { $this->logger->notice('magento_import returns empty result by path ' . $filePath . ' for theme ' . $theme->getCode()); } return $result; }
/** * Retrieve files * * @param ThemeInterface $theme * @param string $filePath * @return \Magento\Framework\View\File[] */ public function getFiles(ThemeInterface $theme, $filePath) { $list = $this->fileListFactory->create('Magento\\Framework\\Css\\PreProcessor\\File\\FileList\\Collator'); $files = $this->libraryDirectory->search($filePath); $list->add($this->createFiles($this->libraryDirectory, $theme, $files)); foreach ($theme->getInheritedThemes() as $currentTheme) { $themeFullPath = $currentTheme->getFullPath(); $path = $this->componentRegistrar->getPath(ComponentRegistrar::THEME, $themeFullPath); if (empty($path)) { continue; } $directoryRead = $this->readFactory->create($path); $foundFiles = $directoryRead->search("web/{$filePath}"); $list->replace($this->createFiles($directoryRead, $theme, $foundFiles)); } return $list->getAll(); }
/** * @expectedException \UnexpectedValueException * @expectedExceptionMessage Magento\Framework\View\File\FileList\Collator has to implement the collate interface. */ public function testCreateException() { $collator = new \stdClass(); $this->objectManager->expects($this->once())->method('get')->with($this->equalTo(\Magento\Framework\View\File\FileList\Factory::FILE_LIST_COLLATOR))->will($this->returnValue($collator)); $this->model->create(); }