diff --git a/modules/backend/classes/FormField.php b/modules/backend/classes/FormField.php index 6428904f2..36a0dab75 100644 --- a/modules/backend/classes/FormField.php +++ b/modules/backend/classes/FormField.php @@ -94,6 +94,11 @@ class FormField */ public $required = false; + /** + * @var bool Specify if the field is read-only or not. + */ + public $readOnly = false; + /** * @var bool Specify if the field is disabled or not. */ @@ -266,6 +271,7 @@ class FormField 'placeholder', 'dependsOn', 'required', + 'readOnly', 'disabled', 'cssClass', 'stretch', @@ -417,6 +423,10 @@ class FormField $attributes = $attributes + ['disabled' => 'disabled']; } + if ($position == 'field' && $this->readOnly) { + $attributes = $attributes + ['readonly' => 'readonly']; + } + return $attributes; }