Skip to content

Commit 2055291

Browse files
issue #19609 fixed
1 parent b5f866f commit 2055291

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

app/code/Magento/Config/Block/System/Config/Form.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,12 @@ protected function _initElement(
366366

367367
$sharedClass = $this->_getSharedCssClass($field);
368368
$requiresClass = $this->_getRequiresCssClass($field, $fieldPrefix);
369+
$isReadOnly = $this->isDefaultFieldReadOnly($path);
370+
if (!$isReadOnly) {
371+
$isReadOnly = $this->getElementVisibility()->isDisabled($field->getPath())
372+
?: $this->getSettingChecker()->isReadOnly($path, $this->getScope(), $this->getStringScopeCode());
373+
}
369374

370-
$isReadOnly = $this->getElementVisibility()->isDisabled($field->getPath())
371-
?: $this->getSettingChecker()->isReadOnly($path, $this->getScope(), $this->getStringScopeCode());
372375
$formField = $fieldset->addField(
373376
$elementId,
374377
$field->getType(),
@@ -797,6 +800,24 @@ private function getAppConfig()
797800
return $this->appConfig;
798801
}
799802

803+
/**
804+
* Check Default Path Readonly
805+
*
806+
* @param string $path
807+
* @return boolean
808+
*/
809+
private function isDefaultFieldReadOnly($path)
810+
{
811+
$scope = $this->getScope();
812+
$isReadOnly = false;
813+
if ($scope !== ScopeConfigInterface::SCOPE_TYPE_DEFAULT) {
814+
$isReadOnly = $this->getSettingChecker()->isReadOnly(
815+
$path, ScopeConfigInterface::SCOPE_TYPE_DEFAULT
816+
);
817+
}
818+
return $isReadOnly;
819+
}
820+
800821
/**
801822
* Retrieve deployment config data value by path
802823
*

app/code/Magento/Config/Test/Unit/Block/System/Config/FormTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ public function testInitFields(
532532

533533
$elementVisibilityMock = $this->getMockBuilder(ElementVisibilityInterface::class)
534534
->getMockForAbstractClass();
535-
$elementVisibilityMock->expects($this->once())
535+
$elementVisibilityMock->expects($this->any())
536536
->method('isDisabled')
537537
->willReturn($isDisabled);
538538

0 commit comments

Comments
 (0)