Jump to content

Basilico

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by Basilico

  1. I'm trying to attach the hook initTwig into the template (_init.php), but it doesn't work.

    wire()->addHookAfter("TemplateEngineTwig::initTwig", function(HookEvent $event) {
      $twig = $event->arguments('twig');
      // Extend $twig with custom code
    });

     

    By now, I'm able to hook it correctly only by hooking within a class (for example a class defined in a module), but sometimes it's useful to extend it directly from a template without the hassle of dealing with a module.

    Anyone experiencing the same issue?
    Thanks!

×
×
  • Create New...