0
 if ($formName == 'CRM_Contribute_Form_Contribution_Confirm' && $form->_id == 1) {


   CRM_Core_Resources::singleton()->addScriptFile(drupal_get_path('module','custom_water') .'/',
     'custom_water.js');

}

When I use the above code as mentioned in the link https://wiki.civicrm.org/confluence/display/CRMDOC43/Resource+Reference#ResourceReference-Introduction

Add a Javascript file PHP CRM_Core_Resources::singleton()->addScriptFile('com.example.foo', 'bar.js');

I get an error : Fatal error: Class 'CRM_Core_Resources' not found in

I am using drupal 7 with CiviCRM

2
  • I think the error message you're posting got cut off, please finish it? Also, are you adding this code to a Drupal module or CiviCRM extension? Mar 20, 2016 at 16:58
  • @JonG I am adding the code in drupal module
    – harshal
    Mar 21, 2016 at 7:26

1 Answer 1

0

if it is on drupal module add civicrm_initialize(); method above that line

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.