From f91f3d6001fd037d9dbcf5d58f58e7c211e3ecd7 Mon Sep 17 00:00:00 2001 From: Flyingmana Date: Thu, 20 Aug 2015 00:51:40 +0200 Subject: [PATCH] add support for loading etc/adminhtml/system.xml for modules outside app/code also likely to solve the problem for other etc files of a module --- .../Magento/Framework/Module/Dir/Reader.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Module/Dir/Reader.php b/lib/internal/Magento/Framework/Module/Dir/Reader.php index 5f5167f88efa7..8368a60032561 100644 --- a/lib/internal/Magento/Framework/Module/Dir/Reader.php +++ b/lib/internal/Magento/Framework/Module/Dir/Reader.php @@ -14,6 +14,7 @@ use Magento\Framework\Filesystem\Directory\Read; use Magento\Framework\Module\Dir; use Magento\Framework\Module\ModuleListInterface; +use Magento\Framework\Module\ModuleRegistryInterface; class Reader { @@ -43,6 +44,11 @@ class Reader */ protected $modulesDirectory; + /** + * @var ModuleRegistryInterface + */ + protected $moduleRegistry; + /** * @var FileIteratorFactory */ @@ -53,15 +59,18 @@ class Reader * @param ModuleListInterface $moduleList * @param Filesystem $filesystem * @param FileIteratorFactory $fileIteratorFactory + * @param ModuleRegistryInterface $moduleRegistry */ public function __construct( Dir $moduleDirs, ModuleListInterface $moduleList, Filesystem $filesystem, - FileIteratorFactory $fileIteratorFactory + FileIteratorFactory $fileIteratorFactory, + ModuleRegistryInterface $moduleRegistry ) { $this->moduleDirs = $moduleDirs; $this->modulesList = $moduleList; + $this->moduleRegistry = $moduleRegistry; $this->fileIteratorFactory = $fileIteratorFactory; $this->modulesDirectory = $filesystem->getDirectoryRead(DirectoryList::MODULES); } @@ -78,6 +87,9 @@ public function getConfigurationFiles($filename) foreach ($this->modulesList->getNames() as $moduleName) { $file = $this->getModuleDir('etc', $moduleName) . '/' . $filename; $path = $this->modulesDirectory->getRelativePath($file); + if ($this->moduleRegistry->getModulePath($moduleName) !== null) { + $path = str_replace(BP, '/../..', $path); + } if ($this->modulesDirectory->isExist($path)) { $result[] = $path; }