@@ -143,13 +143,15 @@ public function __construct(
143
143
\Magento \Config \Model \Config \Structure $ configStructure ,
144
144
\Magento \Config \Block \System \Config \Form \Fieldset \Factory $ fieldsetFactory ,
145
145
\Magento \Config \Block \System \Config \Form \Field \Factory $ fieldFactory ,
146
- array $ data = []
146
+ array $ data = [],
147
+ SettingChecker $ settingChecker = null
147
148
) {
148
149
parent ::__construct ($ context , $ registry , $ formFactory , $ data );
149
150
$ this ->_configFactory = $ configFactory ;
150
151
$ this ->_configStructure = $ configStructure ;
151
152
$ this ->_fieldsetFactory = $ fieldsetFactory ;
152
153
$ this ->_fieldFactory = $ fieldFactory ;
154
+ $ this ->settingChecker = $ settingChecker ?: ObjectManager::getInstance ()->get (SettingChecker::class);
153
155
154
156
$ this ->_scopeLabels = [
155
157
self ::SCOPE_DEFAULT => __ ('[GLOBAL] ' ),
@@ -158,18 +160,6 @@ public function __construct(
158
160
];
159
161
}
160
162
161
- /**
162
- * @deprecated 100.1.2
163
- * @return SettingChecker
164
- */
165
- private function getSettingChecker ()
166
- {
167
- if ($ this ->settingChecker === null ) {
168
- $ this ->settingChecker = ObjectManager::getInstance ()->get (SettingChecker::class);
169
- }
170
- return $ this ->settingChecker ;
171
- }
172
-
173
163
/**
174
164
* Initialize objects required to render config form
175
165
*
@@ -366,9 +356,8 @@ protected function _initElement(
366
356
367
357
$ sharedClass = $ this ->_getSharedCssClass ($ field );
368
358
$ requiresClass = $ this ->_getRequiresCssClass ($ field , $ fieldPrefix );
359
+ $ isReadOnly = $ this ->isReadOnly ($ field , $ path );
369
360
370
- $ isReadOnly = $ this ->getElementVisibility ()->isDisabled ($ field ->getPath ())
371
- ?: $ this ->getSettingChecker ()->isReadOnly ($ path , $ this ->getScope (), $ this ->getStringScopeCode ());
372
361
$ formField = $ fieldset ->addField (
373
362
$ elementId ,
374
363
$ field ->getType (),
@@ -417,7 +406,7 @@ private function getFieldData(\Magento\Config\Model\Config\Structure\Element\Fie
417
406
{
418
407
$ data = $ this ->getAppConfigDataValue ($ path );
419
408
420
- $ placeholderValue = $ this ->getSettingChecker () ->getPlaceholderValue (
409
+ $ placeholderValue = $ this ->settingChecker ->getPlaceholderValue (
421
410
$ path ,
422
411
$ this ->getScope (),
423
412
$ this ->getStringScopeCode ()
@@ -797,6 +786,26 @@ private function getAppConfig()
797
786
return $ this ->appConfig ;
798
787
}
799
788
789
+ /**
790
+ * Check Path is Readonly
791
+ *
792
+ * @param \Magento\Config\Model\Config\Structure\Element\Field $field
793
+ * @param string $path
794
+ * @return boolean
795
+ */
796
+ private function isReadOnly (\Magento \Config \Model \Config \Structure \Element \Field $ field , $ path )
797
+ {
798
+ $ isReadOnly = $ this ->settingChecker ->isReadOnly (
799
+ $ path ,
800
+ ScopeConfigInterface::SCOPE_TYPE_DEFAULT
801
+ );
802
+ if (!$ isReadOnly ) {
803
+ $ isReadOnly = $ this ->getElementVisibility ()->isDisabled ($ field ->getPath ())
804
+ ?: $ this ->settingChecker ->isReadOnly ($ path , $ this ->getScope (), $ this ->getStringScopeCode ());
805
+ }
806
+ return $ isReadOnly ;
807
+ }
808
+
800
809
/**
801
810
* Retrieve deployment config data value by path
802
811
*
0 commit comments