When using /layout/set legacy module through LegacyKernelController having a module layout configured, result from legacy kernel is rendered using this module layout.
However, when using /layout/set, you already define a layout in legacy stack (via layout.ini. Problem is that the result from /layout/set will be embedded in the configured module layout, which can give very unexpected results.
Best example is that when you want to render XML, JSON or anything not HTML, you'll have the result embedded in some HTML layout.
With the following config, AcmeLegacyTestBudle::pagelayout_legacy.html.twig will be used for rendering result from legacy modules.
With this config, you expect that plainlayout.tpl will be used (goal is to render CSS code obviously), using text/css content type.
When calling /layout/set/css/content/view/css/1234, content will be:
- rendered using plainlayout.tpl by legacy kernel => OK
- rendered using AcmeLegacyTestBudle::pagelayout_legacy.html.twig by LegacyKernelController => Not OK as this layout contains HTML code.