return key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
}
+ /**
+ * Add the payment processor select to the form.
+ *
+ * @param bool $isRequired
+ * Is it a mandatory field.
+ * @param bool $isBuildRecurBlock
+ * True if we want to build recur on change
+ * @param bool $isBuildAutoRenewBlock
+ * True if we want to build autorenew on change.
+ */
+ protected function addPaymentProcessorSelect($isRequired, $isBuildRecurBlock = FALSE, $isBuildAutoRenewBlock = FALSE) {
+ if (!$this->_mode) {
+ return;
+ }
+ $js = ($isBuildRecurBlock ? array('onChange' => "buildRecurBlock( this.value ); return false;") : NULL);
+ if ($isBuildAutoRenewBlock) {
+ $js = array('onChange' => "buildAutoRenew( null, this.value, '{$this->_mode}');");
+ }
+ $element = $this->add('select',
+ 'payment_processor_id',
+ ts('Payment Processor'),
+ array_diff_key($this->_processors, array(0 => 1)),
+ $isRequired,
+ $js
+ );
+ // The concept of _online is not really explained & the code is old
+ // @todo figure out & document.
+ if ($this->_online) {
+ $element->freeze();
+ }
+ }
+
}