Email layouts: the header, footer and page layout around your emails
Describes Templates Editor 0.2.0.
A layout is what wraps an email: a header, a footer and a page layout around the email’s own text. The Templates editor shows your layouts, lets you edit their parts, make new ones and choose which layout each email uses.
Where to find it
Settings › Emails Transactional, tab Email templates (/admin/settings/email-sending), the Layouts group in the left column. The same rules apply as for the rest of the editor: the module switched on, the Settings and Templates editor permissions to see it, and the Edit email templates permission on a server where editing is allowed to change anything. See the guide on editing email templates.
The editor shows only the layouts the host developer named in its configuration.
Reading a layout
Each layout in the list shows:
- Its name, with a default badge on the layout that emails get when they don’t choose one. The default comes first.
- Its three parts, Header, Footer and Page layout. A part the layout has its own file for can be clicked to open it in the editor, like any template. A part it doesn’t have is inherited, and the list says from where: inherited: the shared one (the site-wide header, footer or layout) or inherited: core’s default (PhoenixKit’s own). A part marked its own, not editable here has a file, but one this editor isn’t allowed to open.
- Which emails use it (Used by …), or No email uses it.
The parts of a layout have their own variables, such as the site’s address. The Variables panel shows them when you open a part. A hint at the top of the tab lists the variables that work only in the header, the footer and the layout.
The preview of a header, footer or page layout shows it around the first email that uses the layout.
Creating a layout
New layout under the list makes a layout as a copy of one that has parts of its own. Type a Layout name, pick Copy of layout …, then Create layout. The name must fit the layouts the host allows; otherwise a message lists the allowed ones. A layout with that name must not exist yet.
The form only appears when at least one layout has parts of its own to copy.
Choosing an email’s layout
Open an email. The Layout field above its language tabs lists the default (shown as default (…) with its name) and the other layouts. Picking one takes effect right away: there is no Save button for it, and the preview is drawn again. A notice confirms, for example “…” now has the layout “…”.
On a read-only server the field is replaced by a line saying which layout the email uses.
Deleting a layout
Delete next to a layout’s name (shown for layouts with parts of their own) asks Delete the layout “…”: its own header, footer and page layout, in every language? Confirm with Delete, or Cancel.
A layout that emails still use can’t be deleted. The message names those emails: give them another layout first.
What it doesn’t do
- It doesn’t edit the shared header, footer and layout, which also wrap PhoenixKit’s sign-in and password emails, unless the host allows it in the configuration.
- It doesn’t create a layout from nothing: a new layout always starts as a copy.
- It doesn’t come with layouts of its own. Without any files, emails use PhoenixKit’s built-in header and footer.
For developers
The layouts the editor shows come from layout_group (the default) and layout_groups in config :phoenix_kit_templates_editor. Editing the shared _header, _footer and _layout needs shared_layout_editable: true.