+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2017 |
+ | Copyright CiviCRM LLC (c) 2004-2018 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2017
+ * @copyright CiviCRM LLC (c) 2004-2018
*/
/**
foreach ($settingMetaData as $setting => $props) {
if (isset($props['quick_form_type'])) {
if (isset($props['pseudoconstant'])) {
- if (array_key_exists('optionGroupName', $props['pseudoconstant'])) {
- $optionValues = civicrm_api3('OptionValue', 'get', array(
- 'return' => array("label", "value"),
- 'option_group_id' => $setting,
- ));
- if ($optionValues['count'] > 0) {
- foreach ($optionValues['values'] as $key => $values) {
- $vals[$values['value']] = $values['label'];
- }
- $options['values'] = $vals;
- }
- }
- else {
- $options = civicrm_api3('Setting', 'getoptions', array(
- 'field' => $setting,
- ));
- }
+ $options = civicrm_api3('Setting', 'getoptions', array(
+ 'field' => $setting,
+ ));
}
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') {
);
}
elseif ($add == 'addSelect') {
- $element = $this->addElement('select', $setting, ts($props['title']), $options['values'], CRM_Utils_Array::value('html_attributes', $props));
- if (defined('CIVICRM_ENVIRONMENT')) {
- $element->freeze();
- CRM_Core_Session::setStatus(ts('The environment settings have been disabled because it has been overridden in the settings file.'), ts('Environment settings'), 'info');
- }
+ $this->addElement('select', $setting, ts($props['title']), $options['values'], CRM_Utils_Array::value('html_attributes', $props));
}
elseif ($add == 'addCheckBox') {
$this->addCheckBox($setting, ts($props['title']), $options['values'], NULL, CRM_Utils_Array::value('html_attributes', $props), NULL, NULL, array(' '));
}
}
+ if (!empty($setStatus)) {
+ CRM_Core_Session::setStatus(ts("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);