You are here

function wf_crm_webform_base::addPaymentJs in Webform CiviCRM Integration 7.4

Same name and namespace in other branches
  1. 7.5 includes/wf_crm_webform_base.inc \wf_crm_webform_base::addPaymentJs()

CiviCRM JS can't be attached to a drupal form so have to manually re-add this during validation

2 calls to wf_crm_webform_base::addPaymentJs()
wf_crm_webform_postprocess::validate in includes/wf_crm_webform_postprocess.inc
Called after a webform is submitted Or, for a multipage form, called after each page
wf_crm_webform_preprocess::addResources in includes/wf_crm_webform_preprocess.inc
Add necessary js & css to the form

File

includes/wf_crm_webform_base.inc, line 888

Class

wf_crm_webform_base
Class wf_crm_webform_base

Code

function addPaymentJs() {
  $currentVer = CRM_Core_BAO_Domain::version();
  if (version_compare($currentVer, '5.8') <= 0 && method_exists('CRM_Core_Payment_Form', 'getCreditCardCSSNames')) {
    $credit_card_types = CRM_Core_Payment_Form::getCreditCardCSSNames();
    CRM_Core_Resources::singleton()
      ->addCoreResources()
      ->addSetting(array(
      'config' => array(
        'creditCardTypes' => $credit_card_types,
      ),
    ))
      ->addScriptFile('civicrm', 'templates/CRM/Core/BillingBlock.js', -10, 'html-header');
  }
  else {
    CRM_Core_Resources::singleton()
      ->addCoreResources();
    CRM_Financial_Form_Payment::addCreditCardJs(NULL, 'html-header');
  }
}