Skip to content

add support for loading etc/adminhtml/system.xml for modules outside … #1709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/internal/Magento/Framework/Module/Dir/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -43,6 +44,11 @@ class Reader
*/
protected $modulesDirectory;

/**
* @var ModuleRegistryInterface
*/
protected $moduleRegistry;

/**
* @var FileIteratorFactory
*/
Expand All @@ -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);
}
Expand All @@ -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;
}
Expand Down