function WebformCivicrmBase::addPaymentJs in Webform CiviCRM Integration 8.5
CiviCRM JS can't be attached to a drupal form so have to manually re-add this during validation
Return value
void
2 calls to WebformCivicrmBase::addPaymentJs()
- WebformCivicrmPostProcess::validate in src/
WebformCivicrmPostProcess.php - Called after a webform is submitted Or, for a multipage form, called after each page
- WebformCivicrmPreProcess::addResources in src/
WebformCivicrmPreProcess.php - Add necessary js & css to the form
File
- src/
WebformCivicrmBase.php, line 751 - Front-end form handler base class.
Class
- WebformCivicrmBase
- Class WebformCivicrmBase
Namespace
Drupal\webform_civicrmCode
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([
'config' => [
'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');
}
}