-
Improvement
-
Resolution: Fixed
-
Minor
-
3.0.2
-
MOODLE_30_STABLE
-
MOODLE_31_STABLE
-
MDL-52990-email-themes -
This is a follow on from MDL-49682 but extended across the whole system to all emails.
There needs to be a single generic template which wraps all outgoing emails so that emails can be themed in the same way as anything else. It will take as input the text or html chunk which has already been processed at a deeper level, eg the forum template. The default template would not add anything and it is only intended to be overridden in a theme.
Some use cases:
- adding a small footer with the ABN, Cricos number, who the email is directed at, support details, and other guff that corporates, gov, or edu often want or are required to add.
- adding minimal html header and footer wrapping and css to make the html format much nicer, for instance putting it into a max-width div / table and a bit of inline colour to match the web theme.
A themer should be able to do all of this easily in 3 templates, one for text email and one for html email, and one for the subject, without touching any of the possible sub-templates (eg the forum template).
theme/mytheme/templates/core/email_subject.mustache
theme/mytheme/templates/core/email_text.mustache
theme/mytheme/templates/core/email_html.mustache
I'd say this should be implemented near the end of email_to_user but care needs to be taken so that any emails don't get double formatted, ie in MDL-49682 moustache templates the html already has a <head> element (which is empty) which should be removed. So probably a quick audit to make ensure all emails in code or templates are only producing a chunk of html and not a full html document. Or possible email_to_user could parse out any head content and pass that into the generic template which would concat it together with any generic head content?
ie I'd say a very common subject template would be something like below so that all emails are consistently branded:
"[{{{siteshortname}}}] {{{subject}}}"
|