Skip to content

Commit

Permalink
fixed read only field in system settings
Browse files Browse the repository at this point in the history
  • Loading branch information
jm-extend committed Sep 5, 2024
1 parent b257fce commit b1e2ba7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
15 changes: 15 additions & 0 deletions Block/System/Config/Field/Readonlyfield.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Extend\Warranty\Block\System\Config\Field;

use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Config\Block\System\Config\Form\Field;

class ReadonlyField extends Field
{
protected function _getElementHtml(AbstractElement $element)
{
$element->setData('readonly', 'readonly');
return $element->getElementHtml();
}
}
7 changes: 4 additions & 3 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@
</comment>
<depends>
<field id="warranty/authentication/auth_mode">1</field>
</depends>
<disabled>1</disabled>
</depends>
<frontend_model>Extend\Warranty\Block\System\Config\Field\Readonlyfield</frontend_model>
</field>
<field id="client_id"
translate="label comment"
Expand Down Expand Up @@ -297,7 +297,8 @@
</comment>
<depends>
<field id="warranty/authentication/auth_mode">0</field>
</depends>
</depends>
<frontend_model>Extend\Warranty\Block\System\Config\Field\Readonlyfield</frontend_model>
</field>
<field id="sandbox_client_id"
translate="label comment"
Expand Down

0 comments on commit b1e2ba7

Please sign in to comment.