Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Aggregated.php
Go to the documentation of this file.
1 <?php
8 
12 
17 {
23  protected $baseFiles;
24 
30  protected $themeFiles;
31 
37  protected $themeModularFiles;
38 
42  protected $libDirectory;
43 
47  protected $fileFactory;
48 
56  public function __construct(
57  \Magento\Framework\Filesystem $filesystem,
58  \Magento\Framework\View\File\Factory $fileFactory,
62  ) {
63  $this->libDirectory = $filesystem->getDirectoryRead(DirectoryList::LIB_WEB);
64  $this->fileFactory = $fileFactory;
65  $this->baseFiles = $baseFiles;
66  $this->themeFiles = $themeFiles;
67  $this->themeModularFiles = $themeModularFiles;
68  }
69 
78  public function getFiles(ThemeInterface $theme, $filePath)
79  {
80  if (empty($filePath)) {
81  throw new \InvalidArgumentException('File path must be specified');
82  }
83  $files = [];
84  if ($this->libDirectory->isExist($filePath)) {
85  $filename = $this->libDirectory->getAbsolutePath($filePath);
86  $files[] = $this->fileFactory->create($filename);
87  }
88 
89  $files = array_merge($files, $this->baseFiles->getFiles($theme, $filePath));
90 
91  foreach ($theme->getInheritedThemes() as $currentTheme) {
92  $files = array_merge($files, $this->themeModularFiles->getFiles($currentTheme, $filePath));
93  $files = array_merge($files, $this->themeFiles->getFiles($currentTheme, $filePath));
94  }
95  return $files;
96  }
97 }
$theme
__construct(\Magento\Framework\Filesystem $filesystem, \Magento\Framework\View\File\Factory $fileFactory, CollectorInterface $baseFiles, CollectorInterface $themeFiles, CollectorInterface $themeModularFiles)
Definition: Aggregated.php:56
$filesystem
foreach($appDirs as $dir) $files