Skip to content
Snippets Groups Projects
Commit 82600fc7 authored by Peter Hartmann's avatar Peter Hartmann
Browse files

load js with webform

parent 46d021b1
No related branches found
No related tags found
No related merge requests found
...@@ -282,7 +282,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment { ...@@ -282,7 +282,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
* contain a Stripe payment processor, return the api public key for * contain a Stripe payment processor, return the api public key for
* that processor. * that processor.
*/ */
public function stripe_get_key($form) { public static function stripe_get_key($form) {
if (empty($form->_paymentProcessor)) { if (empty($form->_paymentProcessor)) {
return; return;
} }
......
...@@ -183,3 +183,21 @@ function stripe_civicrm_managed(&$entities) { ...@@ -183,3 +183,21 @@ function stripe_civicrm_managed(&$entities) {
} }
} }
} }
/**
* Implementation of hook_civicrm_alterContent
*
* @return void
*/
function stripe_civicrm_alterContent( &$content, $context, $tplName, &$object ) {
if($context == 'form' && !empty($object->_paymentProcessor['class_name'])) {
if($object->_paymentProcessor['class_name'] == 'Payment_Stripe') {
$stripe_key = CRM_Core_Payment_Stripe::stripe_get_key($object);
if(empty($stripe_key)) {
return;
}
$stripeJSURL = CRM_Core_Resources::singleton()->getUrl('com.drastikbydesign.stripe', 'js/civicrm_stripe.js');
$content .= "<script src='{$stripeJSURL}'></script>";
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment