@@ -143,13 +143,15 @@ public function __construct(
143143 \Magento \Config \Model \Config \Structure $ configStructure ,
144144 \Magento \Config \Block \System \Config \Form \Fieldset \Factory $ fieldsetFactory ,
145145 \Magento \Config \Block \System \Config \Form \Field \Factory $ fieldFactory ,
146- array $ data = []
146+ array $ data = [],
147+ SettingChecker $ settingChecker = null
147148 ) {
148149 parent ::__construct ($ context , $ registry , $ formFactory , $ data );
149150 $ this ->_configFactory = $ configFactory ;
150151 $ this ->_configStructure = $ configStructure ;
151152 $ this ->_fieldsetFactory = $ fieldsetFactory ;
152153 $ this ->_fieldFactory = $ fieldFactory ;
154+ $ this ->settingChecker = $ settingChecker ?: ObjectManager::getInstance ()->get (SettingChecker::class);
153155
154156 $ this ->_scopeLabels = [
155157 self ::SCOPE_DEFAULT => __ ('[GLOBAL] ' ),
@@ -158,18 +160,6 @@ public function __construct(
158160 ];
159161 }
160162
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-
173163 /**
174164 * Initialize objects required to render config form
175165 *
@@ -366,9 +356,8 @@ protected function _initElement(
366356
367357 $ sharedClass = $ this ->_getSharedCssClass ($ field );
368358 $ requiresClass = $ this ->_getRequiresCssClass ($ field , $ fieldPrefix );
359+ $ isReadOnly = $ this ->isReadOnly ($ field , $ path );
369360
370- $ isReadOnly = $ this ->getElementVisibility ()->isDisabled ($ field ->getPath ())
371- ?: $ this ->getSettingChecker ()->isReadOnly ($ path , $ this ->getScope (), $ this ->getStringScopeCode ());
372361 $ formField = $ fieldset ->addField (
373362 $ elementId ,
374363 $ field ->getType (),
@@ -417,7 +406,7 @@ private function getFieldData(\Magento\Config\Model\Config\Structure\Element\Fie
417406 {
418407 $ data = $ this ->getAppConfigDataValue ($ path );
419408
420- $ placeholderValue = $ this ->getSettingChecker () ->getPlaceholderValue (
409+ $ placeholderValue = $ this ->settingChecker ->getPlaceholderValue (
421410 $ path ,
422411 $ this ->getScope (),
423412 $ this ->getStringScopeCode ()
@@ -797,6 +786,26 @@ private function getAppConfig()
797786 return $ this ->appConfig ;
798787 }
799788
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+
800809 /**
801810 * Retrieve deployment config data value by path
802811 *
0 commit comments