Template “layouts/.html.twig” is not defined in “default.html.twig” at line 12.

I am using the statement include for dynamic sections in MODx.

It was working fine so far, but today I received the following exception that basically means, my snippet tried to include a file that doesn’t exist. The variableĀ classes was empty that causesĀ a broken website.

In my case I improved my snippet with an if condition.

Protect your AJAX controller action from malicious calls

If you are working with AJAX calls, you should at least verify where the calls are coming from.

Please find the complete code on Gist.