+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
*/
/**
$settings = Civi::settings();
// @todo replace this by defining all in settings.
foreach ($this->_varNames as $groupName => $settingNames) {
+ CRM_Core_Error::deprecatedFunctionWarning('deprecated use of preferences form. This will be removed from core soon');
foreach ($settingNames as $settingName => $options) {
$this->_config->$settingName = $settings->get($settingName);
}
* @return array
*/
public function setDefaultValues() {
- $this->_defaults = array();
+ $this->_defaults = [];
$this->setDefaultsForMetadataDefinedFields();
foreach ($this->_varNames as $groupName => $settings) {
+ CRM_Core_Error::deprecatedFunctionWarning('deprecated use of preferences form. This will be removed from core soon');
foreach ($settings as $settingName => $settingDetails) {
$this->_defaults[$settingName] = isset($this->_config->$settingName) ? $this->_config->$settingName : CRM_Utils_Array::value('default', $settingDetails, NULL);
}
public function cbsDefaultValues(&$defaults) {
foreach ($this->_varNames as $groupName => $groupValues) {
+ CRM_Core_Error::deprecatedFunctionWarning('deprecated use of preferences form. This will be removed from core soon');
foreach ($groupValues as $settingName => $fieldValue) {
if ($fieldValue['html_type'] == 'checkboxes') {
if (isset($this->_config->$settingName) &&
substr($this->_config->$settingName, 1, -1)
);
if (!empty($value)) {
- $defaults[$settingName] = array();
+ $defaults[$settingName] = [];
foreach ($value as $n => $v) {
$defaults[$settingName][$v] = 1;
}
parent::buildQuickForm();
if (!empty($this->_varNames)) {
+ CRM_Core_Error::deprecatedFunctionWarning('deprecated use of preferences form. This will be removed from core soon');
foreach ($this->_varNames as $groupName => $groupValues) {
$formName = CRM_Utils_String::titleToVar($groupName);
$this->assign('formName', $formName);
- $fields = array();
+ $fields = [];
foreach ($groupValues as $fieldName => $fieldValue) {
$fields[$fieldName] = $fieldValue;
$this->addElement('text',
$fieldName,
$fieldValue['title'],
- array(
+ [
'maxlength' => 64,
'size' => 32,
- )
+ ]
);
break;
break;
case 'YesNo':
- $this->addRadio($fieldName, $fieldValue['title'], array(0 => 'No', 1 => 'Yes'), NULL, ' ');
+ $this->addRadio($fieldName, $fieldValue['title'], [0 => 'No', 1 => 'Yes'], NULL, ' ');
break;
case 'checkboxes':
$options = array_flip(CRM_Core_OptionGroup::values($fieldName, FALSE, FALSE, TRUE));
- $newOptions = array();
+ $newOptions = [];
foreach ($options as $key => $val) {
$newOptions[$key] = $val;
}
$fieldValue['title'],
$newOptions,
NULL, NULL, NULL, NULL,
- array(' ', ' ', '<br/>')
+ [' ', ' ', '<br/>']
);
break;
break;
case 'entity_reference':
- $this->addEntityRef($fieldName, $fieldValue['title'], CRM_Utils_Array::value('options', $fieldValue, array()));
+ $this->addEntityRef($fieldName, $fieldValue['title'], CRM_Utils_Array::value('options', $fieldValue, []));
}
}
}
}
- $this->addButtons(array(
- array(
- 'type' => 'next',
- 'name' => ts('Save'),
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- )
- );
+ $this->addButtons([
+ [
+ 'type' => 'next',
+ 'name' => ts('Save'),
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
if ($this->_action == CRM_Core_Action::VIEW) {
$this->freeze();
$value = CRM_Utils_Array::value($settingName, $this->_params);
if ($value) {
$value = trim($value);
- $value = str_replace(array("\r\n", "\r"), "\n", $value);
+ $value = str_replace(["\r\n", "\r"], "\n", $value);
}
$this->_config->$settingName = $value;
break;