本文整理汇总了PHP中Magento\Framework\Module\Dir\Reader::getConfigurationFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP Reader::getConfigurationFiles方法的具体用法?PHP Reader::getConfigurationFiles怎么用?PHP Reader::getConfigurationFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Module\Dir\Reader
的用法示例。
在下文中一共展示了Reader::getConfigurationFiles方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* {@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;
}
示例2: _initializeConfigList
/**
* Init cached list of validation files
*/
protected function _initializeConfigList()
{
if (!$this->_configFiles) {
$this->_configFiles = $this->cache->load(self::CACHE_KEY);
if (!$this->_configFiles) {
$this->_configFiles = $this->moduleReader->getConfigurationFiles('validation.xml');
$this->cache->save(serialize($this->_configFiles), self::CACHE_KEY);
} else {
$this->_configFiles = unserialize($this->_configFiles);
}
}
}
示例3: get
/**
* {@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;
}
示例4: get
/**
* {@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;
}
示例5: get
/**
* {@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;
}
示例6: getViewConfig
/**
* Render view config object for current package and theme
*
* @param array $params
* @return \Magento\Framework\Config\View
*/
public function getViewConfig(array $params = [])
{
$this->assetRepo->updateDesignParams($params);
/** @var $currentTheme \Magento\Framework\View\Design\ThemeInterface */
$currentTheme = $params['themeModel'];
$key = $currentTheme->getCode();
if (isset($this->viewConfigs[$key])) {
return $this->viewConfigs[$key];
}
$configFiles = $this->moduleReader->getConfigurationFiles(basename($this->filename))->toArray();
$themeConfigFile = $currentTheme->getCustomization()->getCustomViewConfigPath();
if (empty($themeConfigFile)
|| !$this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile))
) {
$themeConfigFile = $this->viewFileSystem->getFilename($this->filename, $params);
}
if ($themeConfigFile
&& $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile))
) {
$configFiles[$this->rootDirectory->getRelativePath($themeConfigFile)] = $this->rootDirectory->readFile(
$this->rootDirectory->getRelativePath($themeConfigFile)
);
}
$config = $this->viewFactory->create($configFiles);
$this->viewConfigs[$key] = $config;
return $config;
}
示例7: _getValidator
/**
* Get validator
*
* @param array $data
* @return \Magento\Framework\Validator
*/
protected function _getValidator(array $data)
{
if ($this->_validator !== null) {
return $this->_validator;
}
$configFiles = $this->_modulesReader->getConfigurationFiles('validation.xml');
$validatorFactory = $this->_validatorConfigFactory->create(['configFiles' => $configFiles]);
$builder = $validatorFactory->createValidatorBuilder('customer', 'form');
$builder->addConfiguration('metadata_data_validator', ['method' => 'setAttributes', 'arguments' => [$this->getAllowedAttributes()]]);
$builder->addConfiguration('metadata_data_validator', ['method' => 'setData', 'arguments' => [$data]]);
$builder->addConfiguration('metadata_data_validator', ['method' => 'setEntityType', 'arguments' => [$this->_entityType]]);
$this->_validator = $builder->createValidator();
return $this->_validator;
}
示例8: getParents
/**
* {@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;
}
示例9: _getValidator
/**
* Get validator
*
* @param array $data
* @return \Magento\Framework\Validator
*/
protected function _getValidator(array $data)
{
if (is_null($this->_validator)) {
$configFiles = $this->_modulesReader->getConfigurationFiles('validation.xml');
/** @var $validatorFactory \Magento\Framework\Validator\Config */
$validatorFactory = $this->_validatorConfigFactory->create(array('configFiles' => $configFiles));
$builder = $validatorFactory->createValidatorBuilder('eav_entity', 'form');
$builder->addConfiguration('eav_data_validator', array('method' => 'setAttributes', 'arguments' => array($this->getAllowedAttributes())));
$builder->addConfiguration('eav_data_validator', array('method' => 'setData', 'arguments' => array($data)));
$this->_validator = $builder->createValidator();
}
return $this->_validator;
}
示例10: __construct
/**
* Initialize dependencies
*
* @param \Magento\Framework\ObjectManagerInterface $objectManager
* @param \Magento\Framework\Module\Dir\Reader $moduleReader
*/
public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Framework\Module\Dir\Reader $moduleReader)
{
$this->_objectManager = $objectManager;
$this->_configFiles = $moduleReader->getConfigurationFiles('validation.xml');
}
示例11: get
/**
* Retrieve the list of configuration files with given name that relate to specified scope
*
* @param string $filename
* @param string $scope
* @return array
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function get($filename, $scope)
{
return $this->moduleReader->getConfigurationFiles($filename);
}
示例12: __construct
/**
* Initialize dependencies
*
* @param \Magento\Framework\ObjectManager $objectManager
* @param \Magento\Framework\Module\Dir\Reader $moduleReader
*/
public function __construct(\Magento\Framework\ObjectManager $objectManager, \Magento\Framework\Module\Dir\Reader $moduleReader)
{
$this->_objectManager = $objectManager;
$this->_configFiles = $moduleReader->getConfigurationFiles('validation.xml');
$this->_initializeDefaultTranslator();
}