Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Dependencies.php
Go to the documentation of this file.
1 <?php
11 
16 class Dependencies extends \Magento\Config\Model\Config\Structure\AbstractMapper
17 {
23  protected $_pathConverter;
24 
28  public function __construct(
29  \Magento\Config\Model\Config\Structure\Mapper\Helper\RelativePathConverter $pathConverted
30  ) {
31  $this->_pathConverter = $pathConverted;
32  }
33 
40  public function map(array $data)
41  {
42  if ($this->_hasValue('config/system/sections', $data)) {
43  foreach ($data['config']['system']['sections'] as &$sectionConfig) {
44  $sectionConfig = $this->_processConfig($sectionConfig);
45  }
46  }
47  return $data;
48  }
49 
56  protected function _processConfig($config)
57  {
59 
60  if ($this->_hasValue('children', $config)) {
61  foreach ($config['children'] as &$subConfig) {
62  $subConfig = $this->_processConfig($subConfig);
63  }
64  }
65  return $config;
66  }
67 
74  protected function _processDepends($config)
75  {
76  if ($this->_hasValue('depends/fields', $config)) {
77  foreach ($config['depends']['fields'] as &$field) {
78  $dependPath = $this->_getDependPath($field, $config);
79  $field['dependPath'] = $dependPath;
80  $field['id'] = implode('/', $dependPath);
81  }
82  }
83  return $config;
84  }
85 
94  protected function _getDependPath($field, $config)
95  {
96  $dependPath = $field['id'];
97  $elementPath = $config['path'] . '/' . $config['id'];
98 
99  return explode('/', $this->_pathConverter->convert($elementPath, $dependPath));
100  }
101 }
__construct(\Magento\Config\Model\Config\Structure\Mapper\Helper\RelativePathConverter $pathConverted)
$config
Definition: fraud_order.php:17