Rename unselectable to allowClear for consistency with select2
authorColeman Watts <coleman@civicrm.org>
Fri, 7 Mar 2014 01:36:25 +0000 (20:36 -0500)
committerColeman Watts <coleman@civicrm.org>
Fri, 7 Mar 2014 01:36:25 +0000 (20:36 -0500)
CRM/Activity/BAO/Query.php
CRM/Contact/Form/Edit/Demographics.php
CRM/Contact/Form/Search/Criteria.php
CRM/Contribute/Form/Task/PDFLetter.php
CRM/Core/BAO/CustomField.php
CRM/Core/BAO/UFGroup.php
CRM/Core/Form.php
CRM/Core/Form/Renderer.php
CRM/Mailing/BAO/Query.php
CRM/Member/Form/MembershipBlock.php

index 086c85849bd4b2bf40b44f80dd2b5d6f7f142aff..02b4fd7f5b5ba1b54f8d4fa218ea4233fef21cca 100644 (file)
@@ -470,7 +470,7 @@ class CRM_Activity_BAO_Query {
       2 => ts('Assigned to'),
       1 => ts('Added by'),
     );
-    $form->addRadio('activity_role', NULL, $activityRoles, array('unselectable' => TRUE));
+    $form->addRadio('activity_role', NULL, $activityRoles, array('allowClear' => TRUE));
     $form->setDefaults(array('activity_role' => 3));
     $activityStatus = CRM_Core_PseudoConstant::activityStatus();
     foreach ($activityStatus as $activityStatusID => $activityStatusName) {
index 7325c54441a18feeb58c1a4eea452365e122c318..12a1136be51ec30a6e4ea1fe7ea89c19bbe977c4 100644 (file)
@@ -57,7 +57,7 @@ class CRM_Contact_Form_Edit_Demographics {
         array('id' => "civicrm_gender_{$var}_{$key}")
       );
     }
-    $form->addGroup($genderOptions, 'gender_id', ts('Gender'))->setAttribute('unselectable', TRUE);
+    $form->addGroup($genderOptions, 'gender_id', ts('Gender'))->setAttribute('allowClear', TRUE);
 
     $form->addDate('birth_date', ts('Date of Birth'), FALSE, array('formatType' => 'birth'));
 
index b557289937886d4c838198cac2bb7a4d058d6d38..541461a9796da6df2573c3b50a3bc72d2e36ce51 100644 (file)
@@ -240,7 +240,7 @@ class CRM_Contact_Form_Search_Criteria {
       1 => ts('Exclude'),
       2 => ts('Include by Privacy Option(s)'),
     );
-    $form->addRadio('privacy_toggle', ts('Privacy Options'), $options, NULL, NULL, TRUE);
+    $form->addRadio('privacy_toggle', ts('Privacy Options'), $options, array('allowClear' => FALSE));
 
     // preferred communication method
     $comm = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method');
@@ -418,7 +418,7 @@ class CRM_Contact_Form_Search_Criteria {
     $form->addElement('text', 'changed_by', ts('Modified By'), NULL);
 
     $dates = array(1 => ts('Added'), 2 => ts('Modified'));
-    $form->addRadio('log_date', NULL, $dates, array('unselectable' => TRUE), '<br />');
+    $form->addRadio('log_date', NULL, $dates, array('allowClear' => TRUE), '<br />');
 
     CRM_Core_Form_Date::buildDateRange($form, 'log_date', 1, '_low', '_high', ts('From'), FALSE, FALSE);
   }
@@ -485,7 +485,7 @@ class CRM_Contact_Form_Search_Criteria {
         array('id' => "civicrm_gender_{$var}_{$key}")
       );
     }
-    $form->addGroup($genderOptions, 'gender_id', ts('Gender'))->setAttribute('unselectable', TRUE);
+    $form->addGroup($genderOptions, 'gender_id', ts('Gender'))->setAttribute('allowClear', TRUE);
 
     CRM_Core_Form_Date::buildDateRange($form, 'birth_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
 
index a4f717de9a50649ca1e9dcaf94576a8c32aa746b..a68ccf23b840c235b4acfb54fb3b21e43b4971bc 100644 (file)
@@ -114,7 +114,7 @@ class CRM_Contribute_Form_Task_PDFLetter extends CRM_Contribute_Form_Task {
 
     // Group options for tokens are not yet implemented. dgg
     $options = array(ts('Contact'), ts('Recurring'));
-    $this->addRadio('is_group_by', ts('Grouping contributions in one letter based on'), $options, array('unselectable' => TRUE), "<br/>", FALSE);
+    $this->addRadio('is_group_by', ts('Grouping contributions in one letter based on'), $options, array('allowClear' => TRUE), "<br/>", FALSE);
 
     $this->addButtons(array(
         array(
index e5aa34e42620d19d018e6323e668318e50fba287..848b6b1262dcdfd0e5a65ea9fbd3ac07898f7e75 100644 (file)
@@ -877,7 +877,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
           $qf->addRule($elementName, ts('%1 is a required field.', array(1 => $label)), 'required');
         }
         else {
-          $group->setAttribute('unselectable', TRUE);
+          $group->setAttribute('allowClear', TRUE);
         }
         break;
 
index 0341d8d088158751ac1bbccd229bdd6ead413dc1..868b6a49cc49aef84caa90143ad227c14d79863a 100644 (file)
@@ -1878,7 +1878,7 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
         $form->addRule($name, ts('%1 is a required field.', array(1 => $title)), 'required');
       }
       else {
-        $group->setAttribute('unselectable', TRUE);
+        $group->setAttribute('allowClear', TRUE);
       }
     }
     elseif ($fieldName === 'prefix_id' || $fieldName === 'suffix_id') {
index d1d714b6a24096ece835d7c86ced7b0728207f8d..c16d15d2d126b0aeaf677ca98872e40bc70f8d32 100644 (file)
@@ -773,8 +773,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   function &addRadio($name, $title, $values, $attributes = array(), $separator = NULL, $required = FALSE) {
     $options = array();
     $attributes = $attributes ? $attributes : array();
-    $unselectable = !empty($attributes['unselectable']);
-    unset($attributes['unselectable']);
+    $allowClear = !empty($attributes['allowClear']);
+    unset($attributes['allowClear']);
     $attributes += array('id_suffix' => $name);
     foreach ($values as $key => $var) {
       $options[] = $this->createElement('radio', NULL, NULL, $var, $key, $attributes);
@@ -783,21 +783,21 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     if ($required) {
       $this->addRule($name, ts('%1 is a required field.', array(1 => $title)), 'required');
     }
-    if ($unselectable) {
-      $group->setAttribute('unselectable', TRUE);
+    if ($allowClear) {
+      $group->setAttribute('allowClear', TRUE);
     }
     return $group;
   }
 
-  function addYesNo($id, $title, $unselectable = FALSE, $required = NULL, $attributes = array()) {
+  function addYesNo($id, $title, $allowClear = FALSE, $required = NULL, $attributes = array()) {
     $attributes += array('id_suffix' => $id);
     $choice   = array();
     $choice[] = $this->createElement('radio', NULL, '11', ts('Yes'), '1', $attributes);
     $choice[] = $this->createElement('radio', NULL, '11', ts('No'), '0', $attributes);
 
     $group = $this->addGroup($choice, $id, $title);
-    if ($unselectable) {
-      $group->setAttribute('unselectable', TRUE);
+    if ($allowClear) {
+      $group->setAttribute('allowClear', TRUE);
     }
     if ($required) {
       $this->addRule($id, ts('%1 is a required field.', array(1 => $title)), 'required');
index 21fecf497e5f825f28887502522ad832259e421b..e651a66341630ab7d6b2562d8673b0d9093a2614 100644 (file)
@@ -130,7 +130,7 @@ class CRM_Core_Form_Renderer extends HTML_QuickForm_Renderer_ArraySmarty {
         $this->addOptionsEditLink($el, $element);
       }
 
-      if ($element->getType() == 'group' && $element->getAttribute('unselectable')) {
+      if ($element->getType() == 'group' && $element->getAttribute('allowClear')) {
         $this->appendUnselectButton($el, $element);
       }
     }
index edcec180882d00a65760f796bb37b6ea880c7673..840404636e63451222e667eb554518db1e1995ca 100644 (file)
@@ -388,10 +388,10 @@ class CRM_Mailing_BAO_Query {
     );
 
     // event filters
-    $form->addRadio('mailing_delivery_status', ts('Delivery Status'), CRM_Mailing_PseudoConstant::yesNoOptions('delivered'), array('unselectable' => TRUE));
-    $form->addRadio('mailing_open_status', ts('Trackable Opens'), CRM_Mailing_PseudoConstant::yesNoOptions('open'), array('unselectable' => TRUE));
-    $form->addRadio('mailing_click_status', ts('Trackable URLs'), CRM_Mailing_PseudoConstant::yesNoOptions('click'), array('unselectable' => TRUE));
-    $form->addRadio('mailing_reply_status', ts('Trackable Replies'), CRM_Mailing_PseudoConstant::yesNoOptions('reply'), array('unselectable' => TRUE));
+    $form->addRadio('mailing_delivery_status', ts('Delivery Status'), CRM_Mailing_PseudoConstant::yesNoOptions('delivered'), array('allowClear' => TRUE));
+    $form->addRadio('mailing_open_status', ts('Trackable Opens'), CRM_Mailing_PseudoConstant::yesNoOptions('open'), array('allowClear' => TRUE));
+    $form->addRadio('mailing_click_status', ts('Trackable URLs'), CRM_Mailing_PseudoConstant::yesNoOptions('click'), array('allowClear' => TRUE));
+    $form->addRadio('mailing_reply_status', ts('Trackable Replies'), CRM_Mailing_PseudoConstant::yesNoOptions('reply'), array('allowClear' => TRUE));
 
     $form->add('checkbox', 'mailing_unsubscribe', ts('Unsubscribe Requests'));
     $form->add('checkbox', 'mailing_optout', ts('Opt-out Requests'));
index 9394cc30d87cd73d3756f2cbf22887abaf95cd9c..130f118037fd46d16ddfcc0e47ea77b97ad18791 100644 (file)
@@ -162,7 +162,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
         $this->assign('auto_renew', $this->_renewOption);
       }
       $this->addGroup($membership, 'membership_type', ts('Membership Types'));
-      $this->addGroup($membershipDefault, 'membership_type_default', ts('Membership Types Default'))->setAttribute('unselectable', TRUE);
+      $this->addGroup($membershipDefault, 'membership_type_default', ts('Membership Types Default'))->setAttribute('allowClear', TRUE);
 
       $this->addFormRule(array('CRM_Member_Form_MembershipBlock', 'formRule'), $this->_id);
     }