From f6c21a4334b4d0f34884fa7cf36509c2867fed2b Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Fri, 16 Feb 2018 11:15:17 +0530 Subject: [PATCH] Set readonly for the fields initialised in civicrm_settings.php --- CRM/Admin/Form/Setting.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CRM/Admin/Form/Setting.php b/CRM/Admin/Form/Setting.php index 89e2574084d2..f0d608f6dcfa 100644 --- a/CRM/Admin/Form/Setting.php +++ b/CRM/Admin/Form/Setting.php @@ -105,6 +105,11 @@ public function buildQuickForm() { else { $options = NULL; } + //Load input as readonly whose values are overridden in civicrm.settings.php. + if (Civi::settings()->getMandatory($setting)) { + $props['html_attributes']['readonly'] = TRUE; + $setStatus = TRUE; + } $add = 'add' . $props['quick_form_type']; if ($add == 'addElement') { @@ -147,6 +152,9 @@ public function buildQuickForm() { } } + if (!empty($setStatus)) { + CRM_Core_Session::setStatus("Some fields are loaded as 'readonly' as they have been set (overridden) in civicrm.settings.php.", '', 'info', array('expires' => 0)); + } // setting_description should be deprecated - see Mail.tpl for metadata based tpl. $this->assign('setting_descriptions', $descriptions); $this->assign('settings_fields', $settingMetaData);