0

I'm following the example in the docs. But having figuring out why the registered functions aren't getting called.

Here's my code (well part of it anyway):

function example_civicrm_container($container) {
   $container->addResource(new \Symfony\Component\Config\Resource\FileResource(__FILE__));
   $container->findDefinition('dispatcher')->addMethodCall('addListener',
        ['civi.token.eval', 'evaluate_tokens']
   )
}

function speakcivi_register_tokens(\Civi\Token\Event\TokenRegisterEvent $e) {
   // never get here.
}

Has the dispatcher interface changed? or is there a way to debug the event dispatch?

  • Is your function name actually called example_XXX? If so then that would be the problem. I've done that before. Also the evaluate_tokens in the addMethodCall would need to match an actual function name in your file. – Demerit Nov 3 '20 at 16:50

Your Answer

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

Browse other questions tagged or ask your own question.