Core template events not dispatching in ajax

Hi.

this goes for Mautic 5, in Mautic 4 we did not have that problem.

I am building a plugin and I noticed when page content is loaded via ajax CoreBundle/CommonController->ajaxAction is not dispatching

CoreEvents::VIEW_INJECT_CUSTOM_CONTENT
CoreEvents::VIEW_INJECT_CUSTOM_TEMPLATE

and as a result if you override core templates and then go and load page by going directly to url of the page modifications are visible, but if you visit page via menu on the left, modifications disappear, because default template is loading.

I can fix that, but before I do, I would just like to know if there is a specific reason why ajaxAction is not dispatching events.

Thank you.

Best, M.

Hey, can you be more specific what Mautic 5 version do you use? Is it Mautic 5.1.0? I can see this fix: Updated CommonController::delegateView to include "mauticTemplate" value in "mauticTemplateVars" for rendering by shinde-rahul · Pull Request #13509 · mautic/mautic · GitHub

Thank you for your reply.

Original version was 5.1.0. I did look at the source of 5.2,0, but I dd not actually test it if it would trigger the events for ajax based request (will do that).

Just from looking into the code it did not seem like this was fixed on 5.2.0. But let me actually test the thing and get back, to be sure.

Best, M.

I have tested this, happens on 5.2.1 as well. I think we need to dispatch events somwhere in ajax version as well.