Skip to content

Commit

Permalink
Merge pull request #11680 from jitendrapurohit/setting
Browse files Browse the repository at this point in the history
CRM-21777 - Set readonly for the fields initialised in civicrm_settings.php
  • Loading branch information
eileenmcnaughton authored Mar 12, 2018
2 parents d8c5e9b + f6c21a4 commit 37f058e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CRM/Admin/Form/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 37f058e

Please sign in to comment.