Twig has much more possibilities, so in ym use-case I want to use it.
I see there is branch twig: https://github.com/batkor/commerce_order_email/blob/twig/src/EventSubscr...
Will this brange be merged?
What needs to be done for it?
Can I do it?
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | commerce_email-support-rendering-an-email-using-a-twig-template-3156158-7.patch | 2.42 KB | khiminrm |
Issue fork commerce_email-3156158
Show commands
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 #2
rszrama commentedComment #3
j. commentedWould be great if we could theme these via twig!
Comment #4
anybodyI agree this would make sense, to allow more reliable and flexible definition of the mail templates, similar to commerce-order-receipt.html.twig.
I think it would even be the better alternative to #3309591: Add CKEditor support to the email body textarea, at least for developers / themers, propably not for non-coders.
So we could think about:
a) Having this as contrib or submodule
b) Having this configurable
c) Have an override order, so that the textarea / WYSIWYG can be used, but is rendered by a twig file, which gets all the variables as twig variables and is thereby able to fully replace the need to use the textarea / WYSIWYG.
I very much like C as it could be integrated and would use progressive enhancement and standard Drupal logics.
@Honza Pobořil to push this forward, you could write a MR implementing this.
Comment #5
rgnyldz commentedIt would be nice to have this in-module but an alternative would be to use symfony mailer where we can already use templates for certain policies. And this module already suggests to use symfony mailer.
Comment #6
rgnyldz commentedAny update on this ?
Comment #7
khiminrm commentedComment #8
khiminrm commentedComment #9
tcrawford commentedAs previously mentioned by RgnYldz if using the symfony mailer it is possible already to use twig templates without the patch. Due to this, I am not sure this is really needed. The existing inline template approach also has advantages in some use cases. I can imagine though that if this patch is added it would make sense to consider making it configurable.
As an example of using symfony mailer with a specific hook_preprocess_HOOK() implementation for a specific mail type.
You can then create a twig template for the specific mail, such as in my case: email--commerce--commerce-email-publication-fulfillment-mail.html.twig
Comment #12
vmarchukTested MR together with the issue and it works great.
Comment #14
vmarchukCommitted!
Comment #16
anybodyThis is small, but powerful! Thank you!!