+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
class CRM_Admin_Form_Options extends CRM_Admin_Form {
/**
- * The option group name
+ * The option group name.
*
* @var array
*/
/**
* Set default values for the form.
- * the default values are retrieved from the database
- *
*
* @return void
*/
public function setDefaultValues() {
$defaults = parent::setDefaultValues();
- if (!isset($defaults['weight']) || !$defaults['weight']) {
- $fieldValues = array('option_group_id' => $this->_gid);
- $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $fieldValues);
+ // Default weight & value
+ $fieldValues = array('option_group_id' => $this->_gid);
+ foreach (array('weight', 'value') as $field) {
+ if (empty($defaults[$field])) {
+ $defaults[$field] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $fieldValues, $field);
+ }
}
//setDefault of contact types for email greeting, postal greeting, addressee, CRM-4575
}
/**
- * Build the form object
+ * Build the form object.
*
* @return void
*/
TRUE
);
+ if ($this->_gName != 'activity_type') {
+ $this->add('text',
+ 'value',
+ ts('Value'),
+ CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'value'),
+ TRUE
+ );
+ }
+
if (!in_array($this->_gName, array(
'email_greeting',
'postal_greeting',
$required = TRUE;
}
elseif ($this->_gName == 'redaction_rule' || $this->_gName == 'engagement_index') {
- $this->add('text',
- 'value',
- ts('Value'),
- CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'value'),
- TRUE
- );
if ($this->_gName == 'redaction_rule') {
$this->add('checkbox',
'filter',
}
/**
- * Global form rule
+ * Global form rule.
*
* @param array $fields
* The input form values.
}
/**
- * Process the form submission
+ * Process the form submission.
*
*
* @return void