richardhj / contao-ajax_reload_element

AjaxReloadElement for Contao Open Source CMS
GNU Lesser General Public License v3.0
14 stars 5 forks source link

Individual template is not loaded after ajax reload #10

Closed theDyingMountain closed 5 years ago

theDyingMountain commented 5 years ago

I use the ajax request for the newsletter form. In the module i choose an individual newsletter template, but after the ajax reload the "nl_default" template is loaded. I think it's because the compile function in "ModuleSubscribe" is not called, only the generate method.

fritzmg commented 5 years ago

I ran into the same issue - though I am currently testing a possible fix.

richardhj commented 5 years ago

Haven't checked the code but it sounds like it is a Contao issue -- the Controller::getFrontendModule should handle the templating.

fritzmg commented 5 years ago

Haven't checked the code but it sounds like it is a Contao issue -- the Controller::getFrontendModule should handle the templating.

Yes and no. Which template to use also depends on the layout and theme. But your hook is executed before Contao sets the template group according to the theme. So if your custom template is within a theme folder, it cannot be used.

fritzmg commented 5 years ago

This code would need to be executed, before you generate the content element or module for the AJAX reponse:

https://github.com/contao/contao/blob/6c4feeeeed5314242a644b7507eaefafb8eb69d8/core-bundle/src/Resources/contao/pages/PageRegular.php#L86-L97

theDyingMountain commented 4 years ago

Thx for fixing this.