Closed (fixed)
Project:
Mailer Plus (DSM+)
Version:
1.2.0
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
5 Apr 2023 at 17:05 UTC
Updated:
20 Jan 2025 at 16:32 UTC
Jump to comment: Most recent
Theme suggestion is not available for the email-wrap template.
Add theme suggestion for email-wrap.html.twig
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
simgui8 commentedComment #4
adamps commentedThanks for the suggestion.
Please can you explain how you would like to use this? I imagined that the email template would be used for markup specific to type, and the email wrap would be similar for all types. email-wrap.html.twig has variables for type and sub_type does that help?
Comment #5
simgui8 commentedYes I needed other markups around the body for different types.
I had those 2 templates to migrates from swiftmailer:
swiftmailer--commerce--order-receipt.html.twig
swiftmailer--user--password-reset.html.twig
I could use email-wrap.html.twig to override all types,
but couldn't use
email-wrap--commerce--receipt-resend.html.twig or
email-wrap--user--password-reset.html.twig
Comment #6
adamps commentedThanks for the reply.
Could you instead put
swiftmailer--user--password-reset.html.twigintoemail--user--password-reset.html.twigor use the GUI at/admin/config/system/mailer/policy/user.password_reset?Comment #7
simgui8 commentedWell, as for the
user--password-reset.html.twig, it's not important.Just happened to have a few trivial mods I wanted to keep migrating to Symfony mailer.
But I know I will for sure want to override
email-wrap.html.twigper type in a lot of projects (like commerce projects).That leaves me with two options :
email-wrap.html.twigin each projectThe patch feels more straightforward and easier to maintain.
Comment #8
adamps commentedSure I understand what you wish to do, thanks for explaining.
When I wrote the template code, I had expected that
email-wrap.html.twigwould be used for general markup that was the same for all emails. Thenemail.html.twig(or mailer policy GUI) would be used for markup that was different for each type. Is there is a reason why you can't do it that way?Comment #9
simgui8 commentedI understand thanks.
Some of the things I may want per type:
Plus verifying each different email once. Changing
email-wrap.html.twigmay impact other templates.When new "rich" email templates are added over time, they may have different wrappers.
Comment #10
adamps commentedThanks however I already understand that you want to change things per type.
As I already mentioned, there are three existing ways of changing things per type:
email-wrap.html.twigusingtypevariablePlease can you explain why none of those work for you and you feel we need a 4th way?
Comment #11
simgui8 commentedNo problem, here:
1: same as #9
2: I already have added a Mailer Policy (great feature), however, I couldn't find how it gives me control over the body wrapper from
email-wrap.html.twig3: Sound like an alternative I "could" use but things might get bloated.
The very existence of
email-wrap.html.twigtemplate kinda makes me expect type suggestion would exist.I feel it's simpler and leaner.
Comment #13
adamps commentedOK thanks for the patch and explanation. Done with doc updates at https://www.drupal.org/docs/contributed-modules/drupal-symfony-mailer/ge....
Comment #15
anybodyRunning into this, I think the sentence
should have its own example.
Am I right that it would be like this?
?
Then I'd add it, just want to be sure it's correct!
Comment #16
anybody@adamps could you maybe tell if my assumption is correct or add an example?