Custom MailTemplate Layout

I’m trying to set the layout to my mail templates defined in my plugin but the backend never shows it, it shows ‘no layout’. I have to select it manually from the dropdown list in order to set the layout of my templates.

this layout is registered with the registerMailLayouts method in my plugin.

layout = "tll-default"
subject = "Welcome Back to the Community!"

Hey @chris

Did you add the layout to the template after it was created in the backend? Try deleting the template and it should recreate, hopefully with the layout selected.

I tried to delete it, it recreates it without the layout selected, the layout is actually null.

the layout is registered in my plugin

 public function registerMailLayouts()
    {
        return [
            'tll-layout'         => 'voilaah.tll::mail._layouts.tll-default',
        ];
    }

Ok I think I see why it happens, the MailLayout is cached in memory. So if a layout and a template is created in the same request, it can’t find the layout.

Added a fix for it in v4.2.21. Let me know if it helps after it has been released.

alright, thanks, will let you know