+--------------------------------------------------------------------+
| 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
*/
/**
$defaults = parent::setDefaultValues();
if (!isset($defaults['weight']) || !$defaults['weight']) {
- $fieldValues = array('option_group_id' => $this->_gid);
+ $fieldValues = ['option_group_id' => $this->_gid];
$defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $fieldValues);
}
if ($this->_action == CRM_Core_Action::UPDATE &&
CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $this->_id, 'is_reserved')
) {
- $this->freeze(array('label', 'is_active'));
+ $this->freeze(['label', 'is_active']);
}
- $this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'weight'), TRUE);
+ $this->add('number', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'weight'), TRUE);
$this->assign('id', $this->_id);
}
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
- $fieldValues = array('option_group_id' => $this->_gid);
+ $fieldValues = ['option_group_id' => $this->_gid];
$wt = CRM_Utils_Weight::delWeight('CRM_Core_DAO_OptionValue', $this->_id, $fieldValues);
if (CRM_Core_BAO_OptionValue::del($this->_id)) {
}
}
else {
- $params = $ids = array();
+ $params = $ids = [];
$params = $this->exportValues();
// set db value of filter in params if filter is non editable
$params['component_id'] = CRM_Core_Component::getComponentID('CiviCampaign');
$optionValue = CRM_Core_OptionValue::addOptionValue($params, $this->_gName, $this->_action, $this->_id);
- CRM_Core_Session::setStatus(ts('The Survey type \'%1\' has been saved.', array(1 => $optionValue->label)), ts('Saved'), 'success');
+ CRM_Core_Session::setStatus(ts('The Survey type \'%1\' has been saved.', [1 => $optionValue->label]), ts('Saved'), 'success');
}
}