/** * {@inheritdoc} * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function get($filename, $scope) { $configPaths = $this->configDirectory->search('{*' . $filename . ',*/*' . $filename . '}'); $configAbsolutePaths = []; foreach ($configPaths as $configPath) { $configAbsolutePaths[] = $this->configDirectory->getAbsolutePath($configPath); } return $this->iteratorFactory->create($configAbsolutePaths); }
/** * {@inheritdoc} */ public function get($filename, $scope) { switch ($scope) { case 'global': $iterator = $this->_moduleReader->getConfigurationFiles($filename); break; case 'design': $iterator = $this->iteratorFactory->create($this->themesDirectory, $this->themesDirectory->search('/*/*/etc/' . $filename)); break; default: $iterator = $this->iteratorFactory->create($this->themesDirectory, array()); break; } return $iterator; }
/** * {@inheritdoc} */ public function get($filename, $scope) { switch ($scope) { case 'global': $iterator = $this->_moduleReader->getConfigurationFiles($filename); break; case 'design': $themePaths = $this->componentDirSearch->collectFiles(ComponentRegistrar::THEME, 'etc/' . $filename); $iterator = $this->iteratorFactory->create($themePaths); break; default: $iterator = $this->iteratorFactory->create([]); break; } return $iterator; }
/** * {@inheritdoc} */ public function get($filename, $scope) { switch ($scope) { case 'global': $iterator = $this->moduleReader->getConfigurationFiles($filename)->toArray(); $themeConfigFile = $this->currentTheme->getCustomization()->getCustomViewConfigPath(); if ($themeConfigFile && $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile))) { $iterator[$this->rootDirectory->getRelativePath($themeConfigFile)] = $this->rootDirectory->readFile($this->rootDirectory->getRelativePath($themeConfigFile)); } else { $designPath = $this->resolver->resolve(RulePool::TYPE_FILE, 'etc/view.xml', $this->area, $this->currentTheme); if (file_exists($designPath)) { try { $designDom = new \DOMDocument(); $designDom->load($designPath); $iterator[$designPath] = $designDom->saveXML(); } catch (\Exception $e) { throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase('Could not read config file')); } } } break; default: $iterator = $this->iteratorFactory->create([]); break; } return $iterator; }
/** * {@inheritdoc} */ public function get($filename, $scope) { switch ($scope) { case 'primary': $directory = $this->filesystem->getDirectoryRead(DirectoryList::CONFIG); $iterator = $this->iteratorFactory->create($directory, $directory->search('{' . $filename . ',*/' . $filename . '}')); break; case 'global': $iterator = $this->_moduleReader->getConfigurationFiles($filename); break; default: $iterator = $this->_moduleReader->getConfigurationFiles($scope . '/' . $filename); break; } return $iterator; }
/** * Go through all modules and find configuration files of active modules * * @param string $filename * @return FileIterator */ public function getConfigurationFiles($filename) { $result = array(); foreach (array_keys($this->modulesList->getModules()) as $moduleName) { $file = $this->getModuleDir('etc', $moduleName) . '/' . $filename; $path = $this->modulesDirectory->getRelativePath($file); if ($this->modulesDirectory->isExist($path)) { $result[] = $path; } } return $this->fileIteratorFactory->create($this->modulesDirectory, $result); }
/** * Go through all modules and find composer.json files of active modules * * @return FileIterator */ public function getComposerJsonFiles() { $result = []; foreach ($this->modulesList->getNames() as $moduleName) { $file = $this->getModuleDir('', $moduleName) . '/composer.json'; $path = $this->modulesDirectory->getRelativePath($file); if ($this->modulesDirectory->isExist($path)) { $result[] = $path; } } return $this->fileIteratorFactory->create($this->modulesDirectory, $result); }
/** * {@inheritdoc} * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function get($filename, $scope) { $moduleDir = $this->modulesDirectory->getAbsolutePath(); $configDir = $this->configDirectory->getAbsolutePath(); $mageScopePath = $moduleDir . '/Magento'; $output = array('base' => array(), 'mage' => array(), 'custom' => array()); $files = glob($moduleDir . '*/*/etc/module.xml'); foreach ($files as $file) { $scope = strpos($file, $mageScopePath) === 0 ? 'mage' : 'custom'; $output[$scope][] = $this->rootDirectory->getRelativePath($file); } $files = glob($configDir . '*/module.xml'); foreach ($files as $file) { $output['base'][] = $this->rootDirectory->getRelativePath($file); } return $this->iteratorFactory->create($this->rootDirectory, array_merge($output['mage'], $output['custom'], $output['base'])); }
/** * {@inheritdoc} */ public function getParents($filename, $scope) { switch ($scope) { case 'global': $iterator = $this->moduleReader->getConfigurationFiles($filename)->toArray(); $designPath = $this->resolver->resolve(RulePool::TYPE_FILE, 'etc/view.xml', $this->area, $this->currentTheme); if (file_exists($designPath)) { try { $iterator = $this->getParentConfigs($this->currentTheme, []); } catch (\Exception $e) { throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase('Could not read config file')); } } break; default: $iterator = $this->iteratorFactory->create([]); break; } return $iterator; }
/** * Create new instance * * @param string $type * @param \Magento\Framework\View\Design\ThemeInterface $theme * @param \Magento\Framework\View\Design\ThemeInterface $parentTheme * @param string[] $files * @return \Magento\DesignEditor\Model\Editor\Tools\Controls\Configuration * @throws \Magento\Framework\Exception */ public function create($type, \Magento\Framework\View\Design\ThemeInterface $theme = null, \Magento\Framework\View\Design\ThemeInterface $parentTheme = null, array $files = []) { $files[] = $this->_getFilePathByType($type, $theme); switch ($type) { case self::TYPE_QUICK_STYLES: $class = 'Magento\\DesignEditor\\Model\\Config\\Control\\QuickStyles'; break; case self::TYPE_IMAGE_SIZING: $class = 'Magento\\DesignEditor\\Model\\Config\\Control\\ImageSizing'; break; default: throw new \Magento\Framework\Exception("Unknown control configuration type: \"{$type}\""); } $rootDirectory = $this->filesystem->getDirectoryRead(DirectoryList::ROOT); $paths = []; foreach ($files as $file) { $paths[] = $rootDirectory->getRelativePath($file); } $fileIterator = $this->fileIteratorFactory->create($rootDirectory, $paths); /** @var $config \Magento\DesignEditor\Model\Config\Control\AbstractControl */ $config = $this->_objectManager->create($class, ['configFiles' => $fileIterator]); return $this->_objectManager->create('Magento\\DesignEditor\\Model\\Editor\\Tools\\Controls\\Configuration', ['configuration' => $config, 'theme' => $theme, 'parentTheme' => $parentTheme]); }
/** * {@inheritdoc} * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function get($filename, $scope) { return $this->iteratorFactory->create($this->configDirectory, $this->configDirectory->search('{*' . $filename . ',*/*' . $filename . '}')); }
/** * {@inheritdoc} */ public function get($filename, $scope) { $iterator = $this->iteratorFactory->create($this->dirSearch->collectFiles(ComponentRegistrar::MODULE, 'etc/' . $filename)); return $iterator; }
/** * Go through all modules and find composer.json files of active modules * * @return FileIterator */ public function getComposerJsonFiles() { return $this->fileIteratorFactory->create($this->getFiles('composer.json')); }
/** * Get list of xsd files * * @param string $filename * @return array */ public function getListXsdFiles($filename) { return $this->iteratorFactory->create(array_merge($this->componentDirSearch->collectFiles(ComponentRegistrar::MODULE, 'etc/' . $filename), $this->componentDirSearch->collectFiles(ComponentRegistrar::LIBRARY, '*/etc/' . $filename))); }
/** * {@inheritdoc} */ public function get($filename, $scope) { $iterator = $this->iteratorFactory->create($this->directoryRead, $this->directoryRead->search('/*/*/etc/data_source/' . $filename)); return $iterator; }