lexik/LexikMailerBundle

Error using global twig vars

tabernicola opened this issue · 1 comments

When I use a global twig var in the body of an email I get an error
Variable "var_name" does not exist in "html_content_b5216d8521f8c6164e8f04d8efc4fd66" at line 5

¿Can I use global twig vars in the emails?

Hi, the bundle does not use the same templating instance, if you want to add globals in email templates you will have to add them on the lexik_mailer.templating service. You can create a compiler pass and call addGlobal() on lexik_mailer.templating to add your globals.