Add select2s
authorlarssandergreen <lars@wildsight.ca>
Sat, 10 Jun 2023 15:48:14 +0000 (09:48 -0600)
committerlarssandergreen <lars@wildsight.ca>
Sat, 10 Jun 2023 15:48:14 +0000 (09:48 -0600)
CRM/Contribute/Form/AbstractEditPayment.php
CRM/Contribute/Form/AdditionalInfo.php
CRM/Contribute/Form/AdditionalPayment.php
CRM/Contribute/Form/Contribution.php
CRM/Contribute/Form/Contribution/Main.php
CRM/Contribute/Form/ContributionPage/Amount.php
CRM/Event/Form/ManageEvent/Registration.php
CRM/PCP/BAO/PCP.php
CRM/Pledge/Form/Pledge.php
templates/CRM/Contribute/Form/Contribution.tpl

index 3c687182d13e1cde784c187ef395fc4f821b4135..df8c29cdc511b4e5c2ce6032788efc8d0f1a50ea 100644 (file)
@@ -706,7 +706,7 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Contact_Form_Task {
       ts('Payment Processor'),
       array_diff_key($this->_processors, [0 => 1]),
       $isRequired,
-      $js
+      $js + ['class' => 'crm-select2']
     );
     // The concept of _online is not really explained & the code is old
     // @todo figure out & document.
index f14aa60698614c59f176feaa27447c3c1b99dfe0..2d451f782ce0a1ff86eb6560740e242491130b45 100644 (file)
@@ -128,10 +128,9 @@ class CRM_Contribute_Form_AdditionalInfo {
 
     $form->add('select', 'contribution_page_id',
       ts('Contribution Page'),
-      [
-        '' => ts('- select -'),
-      ] +
-      CRM_Contribute_PseudoConstant::contributionPage()
+      ['' => ts('- select -')] + CRM_Contribute_PseudoConstant::contributionPage(),
+      FALSE,
+      ['class' => 'crm-select2']
     );
 
     $form->add('textarea', 'note', ts('Notes'), ["rows" => 4, "cols" => 60]);
index f2247c09698338dd92b0bf2da9001b85dc58831b..d5e752fad11a172bd30bf11cc7efcbbe23aabe3f 100644 (file)
@@ -191,7 +191,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
     }
 
     CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE, TRUE, CRM_Utils_Request::retrieve('payment_instrument_id', 'Integer'));
-    $this->add('select', 'payment_processor_id', ts('Payment Processor'), $this->_processors, NULL);
+    $this->add('select', 'payment_processor_id', ts('Payment Processor'), $this->_processors, NULL, ['class' => 'crm-select2']);
 
     $attributes = CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialTrxn');
 
@@ -209,7 +209,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
       $eventID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_id, 'event_id', 'id');
     }
 
-    $this->add('select', 'from_email_address', ts('Receipt From'), CRM_Financial_BAO_Payment::getValidFromEmailsForPayment($eventID ?? NULL));
+    $this->add('select', 'from_email_address', ts('Receipt From'), CRM_Financial_BAO_Payment::getValidFromEmailsForPayment($eventID ?? NULL), FALSE, ['class' => 'crm-select2 huge']);
 
     $this->add('textarea', 'receipt_text', ts('Confirmation Message'));
 
@@ -236,7 +236,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
         ts('Payment Method'),
         ['' => ts('- select -')] + CRM_Contribute_PseudoConstant::paymentInstrument(),
         TRUE,
-        ['onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);"]
+        ['onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);", 'class' => 'crm-select2']
       );
 
       $this->add('text', 'check_number', ts('Check Number'), $attributes['financial_trxn_check_number']);
index d4500ecd1fceabc80c33fa00f9f903cac26ef418..8e78baf48da92ac902d07e0153ea888477087d55 100644 (file)
@@ -651,7 +651,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       ts('Financial Type'),
       ['' => ts('- select -')] + $financialTypes,
       TRUE,
-      ['onChange' => "CRM.buildCustomData( 'Contribution', this.value );"]
+      ['onChange' => "CRM.buildCustomData( 'Contribution', this.value );", 'class' => 'crm-select2']
     );
 
     $paymentInstrument = FALSE;
@@ -662,7 +662,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       $paymentInstrument = $this->add('select', 'payment_instrument_id',
         ts('Payment Method'),
         ['' => ts('- select -')] + CRM_Contribute_BAO_Contribution::buildOptions('payment_instrument_id', 'create'),
-        $required, ['onChange' => "return showHideByValue('payment_instrument_id','{$checkPaymentID}','checkNumber','table-row','select',false);"]
+        $required,
+        ['onChange' => "return showHideByValue('payment_instrument_id','{$checkPaymentID}','checkNumber','table-row','select',false);", 'class' => 'crm-select2']
       );
     }
 
@@ -671,7 +672,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     //add receipt for offline contribution
     $this->addElement('checkbox', 'is_email_receipt', ts('Send Receipt?'));
 
-    $this->add('select', 'from_email_address', ts('Receipt From'), $this->_fromEmails);
+    $this->add('select', 'from_email_address', ts('Receipt From'), $this->_fromEmails, FALSE, ['class' => 'crm-select2 huge']);
 
     $componentDetails = [];
     if ($this->_id) {
@@ -691,7 +692,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     $statusElement = $this->add('select', 'contribution_status_id',
       ts('Contribution Status'),
       $status,
-      FALSE
+      FALSE,
+      ['class' => 'crm-select2']
     );
 
     $currencyFreeze = FALSE;
@@ -756,10 +758,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
         // instead of selecting manually
         $financialTypeIds = CRM_Price_BAO_PriceSet::getAssoc(FALSE, 'CiviContribute', 'financial_type_id');
         $element = $this->add('select', 'price_set_id', ts('Choose price set'),
-          [
-            '' => ts('Choose price set'),
-          ] + $priceSets,
-          NULL, ['onchange' => "buildAmount( this.value, " . json_encode($financialTypeIds) . ");"]
+          ['' => ts('Choose price set')] + $priceSets,
+          NULL,
+          ['onchange' => "buildAmount( this.value, " . json_encode($financialTypeIds) . ");", 'class' => 'crm-select2']
         );
         if ($this->_online && !($this->_action & CRM_Core_Action::UPDATE)) {
           $element->freeze();
index 02d7f88378ed488066953685f306e00033b2aaae..ca70dccdcf33833348d96591f9018031ca713edc 100644 (file)
@@ -681,7 +681,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     //}
 
     $form->add('text', 'installments', ts('installments'),
-      $attributes['installments']
+      $attributes['installments'] + ['class' => 'two']
     );
     $form->addRule('installments', ts('Number of installments must be a whole number.'), 'integer');
 
@@ -714,11 +714,11 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
           }
         }
       }
-      $frequencyUnit = &$form->addElement('select', 'frequency_unit', NULL, $units, ['aria-label' => ts('Frequency Unit')]);
+      $frequencyUnit = &$form->add('select', 'frequency_unit', NULL, $units, FALSE, ['aria-label' => ts('Frequency Unit'), 'class' => 'crm-select2 eight']);
     }
 
     if (!empty($form->_values['is_recur_interval']) || $className == 'CRM_Contribute_Form_Contribution') {
-      $form->add('text', 'frequency_interval', $unit, $attributes['frequency_interval'] + ['aria-label' => ts('Every')]);
+      $form->add('text', 'frequency_interval', $unit, $attributes['frequency_interval'] + ['aria-label' => ts('Every'), 'class' => 'two']);
       $form->addRule('frequency_interval', ts('Frequency must be a whole number (EXAMPLE: Every 3 months).'), 'integer');
     }
     else {
index be00fb12b98267689ebc231b19f54796d4c2688a..b0d246f3746378271c1ec9e21e1881acb3468470 100644 (file)
@@ -175,7 +175,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
         );
         $this->add('datepicker', 'pledge_calendar_date', ts('Specific Calendar Date'), [], FALSE, ['time' => FALSE]);
         $month = CRM_Utils_Date::getCalendarDayOfMonth();
-        $this->add('select', 'pledge_calendar_month', ts('Specific day of Month'), $month);
+        $this->add('select', 'pledge_calendar_month', ts('Specific day of Month'), $month, FALSE, ['class' => 'crm-select2 eight']);
         $pledgeDefaults = [
           'contribution_date' => ts('Day of Contribution'),
           'calendar_date' => ts('Specific Calendar Date'),
index 4a76047396add3944ec26e3d9c34ba3b385fc83d..fe1ac64072f10b4948dd8016553a958781f352c0 100644 (file)
@@ -260,7 +260,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent
       '' => ts('- Unsupervised rule -'),
     ];
     $dedupeRules += CRM_Dedupe_BAO_DedupeRuleGroup::getByType('Individual');
-    $this->add('select', 'dedupe_rule_group_id', ts('Duplicate matching rule'), $dedupeRules);
+    $this->add('select', 'dedupe_rule_group_id', ts('Duplicate matching rule'), $dedupeRules, FALSE, ['class' => 'crm-select2 huge']);
 
     $participantStatuses = CRM_Event_PseudoConstant::participantStatus();
     if (in_array('Awaiting approval', $participantStatuses) and in_array('Pending from approval', $participantStatuses) and in_array('Rejected', $participantStatuses)) {
index bcabd19e667b9f2f4095b321beb9818db09bfa46..978af1f738db42cb4ddb51889d24427988726d51 100644 (file)
@@ -391,7 +391,7 @@ WHERE pcp.id = %1 AND cc.contribution_status_id = %2 AND cc.is_test = 0";
       $form->assign('profile', $profile);
     }
 
-    $form->add('select', 'supporter_profile_id', ts('Supporter Profile'), ['' => ts('- select -')] + $profile, TRUE);
+    $form->add('select', 'supporter_profile_id', ts('Supporter Profile'), ['' => ts('- select -')] + $profile, TRUE, ['class' => 'crm-select2']);
 
     //CRM-15821 - To add new option for PCP "Owner" notification
     $ownerNotifications = CRM_Core_OptionGroup::values('pcp_owner_notify');
index 6ccbfce6f14bacdc0e045eaf1205cc1688a81776..5572b70c4cfae03d96ee4b5f1c1f2525cc7a8344 100644 (file)
@@ -273,7 +273,8 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
     $frequencyUnit = $this->add('select', 'frequency_unit',
       ts('Frequency'),
       ['' => ts('- select -')] + $freqUnitsDisplay,
-      TRUE
+      TRUE,
+      ['class' => 'crm-select2 eight']
     );
 
     $frequencyDay = $this->add('number', 'frequency_day', ts('Payments are due on the'), $attributes['frequency_day'], TRUE);
@@ -317,7 +318,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
         ['onclick' => "showHideByValue( 'is_acknowledge', '', 'acknowledgeDate', 'table-row', 'radio', true); showHideByValue( 'is_acknowledge', '', 'fromEmail', 'table-row', 'radio', false );"]
       );
 
-      $this->add('select', 'from_email_address', ts('Receipt From'), $this->_fromEmails);
+      $this->add('select', 'from_email_address', ts('Receipt From'), $this->_fromEmails, FALSE, ['class' => 'crm-select2 huge']);
     }
 
     $this->add('datepicker', 'acknowledge_date', ts('Acknowledgment Date'), [], FALSE, ['time' => FALSE]);
@@ -325,7 +326,8 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
     $this->add('select', 'financial_type_id',
       ts('Financial Type'),
       ['' => ts('- select -')] + CRM_Contribute_PseudoConstant::financialType(),
-      TRUE
+      TRUE,
+      ['class' => 'crm-select2']
     );
 
     // CRM-7362 --add campaigns.
@@ -341,7 +343,9 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
       $pledgePages[$value['entity_id']] = $pages[$value['entity_id']];
     }
     $this->add('select', 'contribution_page_id', ts('Self-service Payments Page'),
-      ['' => ts('- select -')] + $pledgePages
+      ['' => ts('- select -')] + $pledgePages,
+      FALSE,
+      ['class' => 'crm-select2']
     );
 
     $mailingInfo = Civi::settings()->get('mailing_backend');
index 21aa7a9d562ce81c1ae2188a3b68207a9e23397a..549bb49e2649b506f5aeae1bab1b0617c3a072e9 100644 (file)
             <tr id='recurringPaymentBlock'>
               <td></td>
               <td>
-                <strong>{$form.is_recur.html} {ts}every{/ts}
-                  &nbsp;{$form.frequency_interval.html}
-                  &nbsp;{$form.frequency_unit.html}&nbsp;
-                  {ts}for{/ts}
-                  &nbsp;{$form.installments.html}
-                  &nbsp;{$form.installments.label}
-                </strong>
+                {$form.is_recur.html} {ts}every{/ts}
+                &nbsp;{$form.frequency_interval.html}
+                &nbsp;{$form.frequency_unit.html}&nbsp;
+                {ts}for{/ts}
+                &nbsp;{$form.installments.html}
+                &nbsp;{$form.installments.label}
                 <br />
                 <span class="description">
             {ts}You can leave the number of installments blank if you want to make an open-ended commitment. In either case, you can choose to cancel at any time.{/ts}