1

I'm calling this from a hook but it's not working. Am I doing something wrong?

CRM_Core_Resources::singleton()->addScript("alert('hello');");

I confirmed that it's running by adding debug code to addScript.

2
  • It works fine when I try it. Are you sure your hook is being called?
    – Coleman
    May 2, 2015 at 1:47
  • Okay, thanks for confirming that I'm doing it correctly. When I get a chance, I'll try to debug core and figure out why it's not working for me.
    – bdombro
    May 3, 2015 at 14:38

1 Answer 1

1

The syntax you gave is correct. I suggest you:

  1. Ensure your code is actually running (add a debug statement or exit(); in your code).
  2. Clear your caches. If your page is being cached by the cms then that might be why you're not seeing it.
1
  • Thanks for the answer Coleman, but I'm still having the problem.
    – bdombro
    May 6, 2015 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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