5
5
*/
6
6
namespace Magento \Config \Model ;
7
7
8
+ use Magento \Config \Model \Config \Reader \Source \Deployed \SettingChecker ;
8
9
use Magento \Config \Model \Config \Structure \Element \Group ;
9
10
use Magento \Config \Model \Config \Structure \Element \Field ;
11
+ use Magento \Framework \App \ObjectManager ;
10
12
11
13
/**
12
14
* Backend config model
@@ -80,6 +82,11 @@ class Config extends \Magento\Framework\DataObject
80
82
*/
81
83
protected $ _storeManager ;
82
84
85
+ /**
86
+ * @var Config\Reader\Source\Deployed\SettingChecker
87
+ */
88
+ private $ settingChecker ;
89
+
83
90
/**
84
91
* @param \Magento\Framework\App\Config\ReinitableConfigInterface $config
85
92
* @param \Magento\Framework\Event\ManagerInterface $eventManager
@@ -88,6 +95,7 @@ class Config extends \Magento\Framework\DataObject
88
95
* @param \Magento\Config\Model\Config\Loader $configLoader
89
96
* @param \Magento\Framework\App\Config\ValueFactory $configValueFactory
90
97
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
98
+ * @param Config\Reader\Source\Deployed\SettingChecker|null $settingChecker
91
99
* @param array $data
92
100
*/
93
101
public function __construct (
@@ -98,6 +106,7 @@ public function __construct(
98
106
\Magento \Config \Model \Config \Loader $ configLoader ,
99
107
\Magento \Framework \App \Config \ValueFactory $ configValueFactory ,
100
108
\Magento \Store \Model \StoreManagerInterface $ storeManager ,
109
+ SettingChecker $ settingChecker = null ,
101
110
array $ data = []
102
111
) {
103
112
parent ::__construct ($ data );
@@ -108,6 +117,7 @@ public function __construct(
108
117
$ this ->_configLoader = $ configLoader ;
109
118
$ this ->_configValueFactory = $ configValueFactory ;
110
119
$ this ->_storeManager = $ storeManager ;
120
+ $ this ->settingChecker = $ settingChecker ?: ObjectManager::getInstance ()->get (SettingChecker::class);
111
121
}
112
122
113
123
/**
@@ -351,6 +361,16 @@ protected function _processGroup(
351
361
// use extra memory
352
362
$ fieldsetData = [];
353
363
foreach ($ groupData ['fields ' ] as $ fieldId => $ fieldData ) {
364
+ $ isReadOnly = $ this ->settingChecker ->isReadOnly (
365
+ $ groupPath . '/ ' . $ fieldId ,
366
+ $ this ->getScope (),
367
+ $ this ->getScopeCode ()
368
+ );
369
+
370
+ if ($ isReadOnly ) {
371
+ continue ;
372
+ }
373
+
354
374
$ field = $ this ->getField ($ sectionPath , $ groupId , $ fieldId );
355
375
/** @var \Magento\Framework\App\Config\ValueInterface $backendModel */
356
376
$ backendModel = $ field ->hasBackendModel ()
0 commit comments