{"id":360510,"date":"2022-12-10T14:14:24","date_gmt":"2022-12-10T14:14:24","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=360510"},"modified":"2022-12-12T05:18:22","modified_gmt":"2022-12-12T05:18:22","slug":"apply-an-email-template-transformation-from-a-module","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/","title":{"rendered":"Apply an email template transformation from a module"},"content":{"rendered":"\n<p>In this blog, we will learn how to apply the transformation in Prestashop modern email templates from a module.<\/p>\n\n\n\n<p>The Prestashop has an <code><strong><em>TransformationInterface<\/em><\/strong><\/code>&nbsp;interface to modify your template\u2019s design easily. Here are the interface details:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nnamespace PrestaShop\\PrestaShop\\Core\\MailTemplate\\Transformation;\n\ninterface TransformationInterface\n{\n    \/**\n     * @param string $templateContent\n     * @param array $templateVariables\n     *\n     * @return string\n     *\/\n    public function apply($templateContent, array $templateVariables);\n\n    \/**\n     * Returns the type of templates either html or text\n     *\n     * @return string\n     *\/\n    public function getType();\n\n    \/**\n     * @param LanguageInterface $language\n     *\n     * @return object\n     *\/\n    public function setLanguage(LanguageInterface $language);\n}<\/pre>\n\n\n\n<p>Visit the GitHub link <a href=\"https:\/\/github.com\/PrestaShop\/PrestaShop\/blob\/8.0.0\/src\/Core\/MailTemplate\/Transformation\/TransformationInterface.php\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/PrestaShop\/PrestaShop\/blob\/8.0.0\/src\/Core\/MailTemplate\/Transformation\/TransformationInterface.php<\/a> to get more information about this interface.<\/p>\n\n\n\n<p>The apply method receives the rendered layout as a string to perform replacement and DOM manipulation.<\/p>\n\n\n\n<p>If you don\u2019t want to modify it simply return the string without any changes. The getType method is used to filter transformations and the <strong>setLanguage<\/strong> method will allow you to know about the language used in email generation to identify localized content.<\/p>\n\n\n\n<p>In the following example, we are using a modern custom layout. If you want to create a new layout then follow our <a href=\"https:\/\/webkul.com\/blog\/how-to-add-an-email-layout-and-variables-in-a-theme-from-module\/\" target=\"_blank\" rel=\"noreferrer noopener\">other blog<\/a>.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">{# modules\/demoemail\/mails\/layout\/customizable_modern_layout.html.twig #}\n{% extends &#039;@MailThemes\/modern\/components\/layout.html.twig&#039; %}\n\n{% block content %}\n  &lt;table width=&quot;100%&quot;&gt;\n    &lt;tr&gt;\n      &lt;td align=&quot;center&quot; class=&quot;titleblock&quot;&gt;\n        &lt;font size=&quot;2&quot; face=&quot;{{ languageDefaultFont }}Open-sans, sans-serif&quot; color=&quot;#555454&quot;&gt;\n          &lt;span class=&quot;title&quot;&gt;{{ &#039;This is an example mail template from my module for modern theme&#039;|trans({}, &#039;EmailsBody&#039;, locale)|raw }}&lt;\/span&gt;\n        &lt;\/font&gt;\n      &lt;\/td&gt;\n    &lt;\/tr&gt;\n    &lt;tr&gt;\n      &lt;td align=&quot;center&quot; class=&quot;titleblock&quot;&gt;\n        &lt;font size=&quot;2&quot; face=&quot;{{ languageDefaultFont }}Open-sans, sans-serif&quot; color=&quot;#555454&quot;&gt;\n          &lt;span class=&quot;customTitle&quot;&gt;{{ exampleMsg }}&lt;\/span&gt;\n        &lt;\/font&gt;\n      &lt;\/td&gt;\n    &lt;\/tr&gt;\n    &lt;tr&gt;\n      &lt;td class=&quot;space_footer&quot;&gt;&amp;nbsp;&lt;\/td&gt;\n    &lt;\/tr&gt;\n  &lt;\/table&gt;\n{% endblock %}<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\">In the above code the &lt;&lt;strong&gt;&lt;em&gt;span class=&quot;customTitle&quot;&gt;&lt;\/em&gt;&lt;\/strong&gt; that contains the message, we will use this as a CSS selector to apply our transformation.<\/pre>\n\n\n\n<p>In the below code, we&#8217;ll create a class <strong><em>ExampleMsgColorTransformation<\/em><\/strong> that will extend <strong>AbstractTransformation<\/strong> abstract class. The <strong><em><a href=\"https:\/\/github.com\/PrestaShop\/PrestaShop\/blob\/8.0.0\/src\/Core\/MailTemplate\/Transformation\/AbstractTransformation.php\" target=\"_blank\" rel=\"noreferrer noopener\">AbstractTransformation<\/a><\/em><\/strong> class implements the  <strong><a href=\"https:\/\/github.com\/PrestaShop\/PrestaShop\/blob\/8.0.0\/src\/Core\/MailTemplate\/Transformation\/TransformationInterface.php\">TransformationInterface<\/a><\/strong>. The objective of this class is to change the color of all the&nbsp;<code>&lt;span&gt;<\/code>&nbsp;tags with the&nbsp;<code><strong><em>customTitle<\/em><\/strong><\/code>&nbsp;class.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nnamespace PrestaShop\\Module\\Demoemail\\MailTemplate\\Transformation;\n\nuse PrestaShop\\PrestaShop\\Core\\Exception\\InvalidArgumentException;\nuse PrestaShop\\PrestaShop\\Core\\MailTemplate\\MailTemplateInterface;\nuse PrestaShop\\PrestaShop\\Core\\MailTemplate\\Transformation\\AbstractTransformation;\nuse Symfony\\Component\\DomCrawler\\Crawler;\nuse DOMElement;\n\n\/**\n * Class ExampleMsgColorTransformation adds the custom color to all spans\n * with class subtitle.\n *\/\nclass ExampleMsgColorTransformation extends AbstractTransformation\n{\n    \/** @var string *\/\n    private $customColor;\n\n    \/**\n     * @param string $customColor\n     * @throws InvalidArgumentException\n     *\/\n    public function __construct($customColor)\n    {\n        parent::__construct(MailTemplateInterface::HTML_TYPE);\n        $this-&gt;customColor = $customColor;\n    }\n\n    \/**\n     * @inheritDoc\n     *\/\n    public function apply($templateContent, array $templateVariables)\n    {\n        $crawler = new Crawler($templateContent);\n        $customSpans = $crawler-&gt;filter(&#039;span&#091;class=&quot;customTitle&quot;]&#039;);\n        \/** @var DOMElement $customSpan *\/\n        foreach ($customSpans as $customSpan) {\n            $customSpan-&gt;setAttribute(&#039;style&#039;, sprintf(&#039;color: %s;&#039;, $this-&gt;customColor));\n        }\n\n        return $crawler-&gt;html();\n    }\n}<\/pre>\n\n\n\n<p>Now  add your transformation for this layout, you need to use the&nbsp;<code><strong>actionGetMailLayoutTransformations<\/strong><\/code>&nbsp;hook to render this from the module.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nuse PrestaShop\\PrestaShop\\Core\\MailTemplate\\MailTemplateInterface;\nuse PrestaShop\\PrestaShop\\Core\\MailTemplate\\MailTemplateRendererInterface;\nuse PrestaShop\\PrestaShop\\Core\\MailTemplate\\Layout\\LayoutInterface;\nuse PrestaShop\\PrestaShop\\Core\\MailTemplate\\Transformation\\TransformationCollectionInterface;\nuse PrestaShop\\Module\\Demoemail\\MailTemplate\\Transformation\\ExampleMsgColorTransformation;\n\nclass Demoemail extends Module \n{\n   public function install() \n   {\n        return parent::install()\n            &amp;&amp; $this-&gt;registerHook(MailTemplateRendererInterface::GET_MAIL_LAYOUT_TRANSFORMATIONS)\n        ;\n    }\n    \n    public function uninstall() \n    {\n        return parent::uninstall()\n            &amp;&amp; $this-&gt;unregisterHook(MailTemplateRendererInterface::GET_MAIL_LAYOUT_TRANSFORMATIONS)\n        ;        \n    }\n    \n    public function enable() \n    {\n        return parent::enable()\n            &amp;&amp; $this-&gt;registerHook(MailTemplateRendererInterface::GET_MAIL_LAYOUT_TRANSFORMATIONS)\n        ;\n    }\n    \n    public function disable() \n    {\n        return parent::disable()\n            &amp;&amp; $this-&gt;unregisterHook(MailTemplateRendererInterface::GET_MAIL_LAYOUT_TRANSFORMATIONS)\n        ;        \n    }\n    \n    \/**\n     * @param array $hookParams\n     *\/\n    public function hookActionGetMailLayoutTransformations(array $hookParams)\n    {\n        if (!isset($hookParams&#091;&#039;templateType&#039;]) ||\n            MailTemplateInterface::HTML_TYPE !== $hookParams&#091;&#039;templateType&#039;] ||\n            !isset($hookParams&#091;&#039;mailLayout&#039;]) ||\n            !isset($hookParams&#091;&#039;layoutTransformations&#039;])) {\n            return;\n        }\n\n        \/** @var LayoutInterface $mailLayout *\/\n        $mailLayout = $hookParams&#091;&#039;mailLayout&#039;];\n        if ($mailLayout-&gt;getModuleName() != $this-&gt;name) {\n            return;\n        }\n\n        \/** @var TransformationCollectionInterface $transformations *\/\n        $transformations = $hookParams&#091;&#039;layoutTransformations&#039;];\n        $transformations-&gt;add(new ExampleMsgColorTransformation(&#039;#FF0000&#039;));\n    }\n}<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"619\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template-1200x619.png\" alt=\"email_template\" class=\"wp-image-360513\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template-1200x619.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template-300x155.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template-250x129.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template-768x396.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template.png 1294w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>Now go to the \u201cDesign &gt; Email Theme\u201d page and preview your layout you will see that your message has now changed its color.<\/p>\n\n\n\n<p><a href=\"https:\/\/devdocs.prestashop-project.org\/1.7\/modules\/concepts\/mail-templates\/img\/modern_transformed_template.png\"><\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"619\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template_1-1200x619.png\" alt=\"email_template_1\" class=\"wp-image-360514\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template_1-1200x619.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template_1-300x155.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template_1-250x129.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template_1-768x396.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template_1.png 1294w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>That\u2019s all about this blog.<\/p>\n\n\n\n<p>If any issues or doubts please feel free to mention them in the comment section.<\/p>\n\n\n\n<p>I would be happy to help.<\/p>\n\n\n\n<p>Also, you can explore our&nbsp;<a href=\"https:\/\/webkul.com\/prestashop-development\/\">PrestaShop Development Services<\/a>&nbsp;&amp; a large range of quality&nbsp;<a href=\"https:\/\/store.webkul.com\/PrestaShop-Extensions.html\">PrestaShop Modules<\/a>.<\/p>\n\n\n\n<p>For any doubt contact us at&nbsp;<a href=\"mailto:support@webkul.com\">support@webkul.com<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, we will learn how to apply the transformation in Prestashop modern email templates from a module. The Prestashop has an TransformationInterface&nbsp;interface to modify your template\u2019s design easily. Here are the interface details: Visit the GitHub link https:\/\/github.com\/PrestaShop\/PrestaShop\/blob\/8.0.0\/src\/Core\/MailTemplate\/Transformation\/TransformationInterface.php to get more information about this interface. The apply method receives the rendered layout as <a href=\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":388,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[209],"tags":[1347,5576,13246,2065,775],"class_list":["post-360510","post","type-post","status-publish","format-standard","hentry","category-prestashop","tag-email","tag-email-templates","tag-modern-email-templates","tag-prestashop","tag-template"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Apply an email template transformation from a module - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Apply an email template transformation from a module - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"In this blog, we will learn how to apply the transformation in Prestashop modern email templates from a module. The Prestashop has an TransformationInterface&nbsp;interface to modify your template\u2019s design easily. Here are the interface details: Visit the GitHub link https:\/\/github.com\/PrestaShop\/PrestaShop\/blob\/8.0.0\/src\/Core\/MailTemplate\/Transformation\/TransformationInterface.php to get more information about this interface. The apply method receives the rendered layout as [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-10T14:14:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-12T05:18:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template-1200x619.png\" \/>\n<meta name=\"author\" content=\"Amit Kumar Tiwari\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Amit Kumar Tiwari\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/\"},\"author\":{\"name\":\"Amit Kumar Tiwari\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/d9ce9e306c32df23a286ed9b5eb81257\"},\"headline\":\"Apply an email template transformation from a module\",\"datePublished\":\"2022-12-10T14:14:24+00:00\",\"dateModified\":\"2022-12-12T05:18:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/\"},\"wordCount\":294,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template-1200x619.png\",\"keywords\":[\"Email\",\"Email Templates\",\"Modern email templates\",\"prestashop\",\"template\"],\"articleSection\":[\"prestashop\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/\",\"url\":\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/\",\"name\":\"Apply an email template transformation from a module - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template-1200x619.png\",\"datePublished\":\"2022-12-10T14:14:24+00:00\",\"dateModified\":\"2022-12-12T05:18:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template.png\",\"width\":1294,\"height\":668,\"caption\":\"email_template\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Apply an email template transformation from a module\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/d9ce9e306c32df23a286ed9b5eb81257\",\"name\":\"Amit Kumar Tiwari\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0bfab402e3d85cb3f1ed4fbac60ad1c4532edd47917a00da0f77d94c75b54f7d?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0bfab402e3d85cb3f1ed4fbac60ad1c4532edd47917a00da0f77d94c75b54f7d?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Amit Kumar Tiwari\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/amitkr-tiwari139\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Apply an email template transformation from a module - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/","og_locale":"en_US","og_type":"article","og_title":"Apply an email template transformation from a module - Webkul Blog","og_description":"In this blog, we will learn how to apply the transformation in Prestashop modern email templates from a module. The Prestashop has an TransformationInterface&nbsp;interface to modify your template\u2019s design easily. Here are the interface details: Visit the GitHub link https:\/\/github.com\/PrestaShop\/PrestaShop\/blob\/8.0.0\/src\/Core\/MailTemplate\/Transformation\/TransformationInterface.php to get more information about this interface. The apply method receives the rendered layout as [...]","og_url":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2022-12-10T14:14:24+00:00","article_modified_time":"2022-12-12T05:18:22+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template-1200x619.png","type":"","width":"","height":""}],"author":"Amit Kumar Tiwari","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Amit Kumar Tiwari","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/"},"author":{"name":"Amit Kumar Tiwari","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/d9ce9e306c32df23a286ed9b5eb81257"},"headline":"Apply an email template transformation from a module","datePublished":"2022-12-10T14:14:24+00:00","dateModified":"2022-12-12T05:18:22+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/"},"wordCount":294,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template-1200x619.png","keywords":["Email","Email Templates","Modern email templates","prestashop","template"],"articleSection":["prestashop"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/","url":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/","name":"Apply an email template transformation from a module - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template-1200x619.png","datePublished":"2022-12-10T14:14:24+00:00","dateModified":"2022-12-12T05:18:22+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/12\/email_template.png","width":1294,"height":668,"caption":"email_template"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/apply-an-email-template-transformation-from-a-module\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Apply an email template transformation from a module"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/d9ce9e306c32df23a286ed9b5eb81257","name":"Amit Kumar Tiwari","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0bfab402e3d85cb3f1ed4fbac60ad1c4532edd47917a00da0f77d94c75b54f7d?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0bfab402e3d85cb3f1ed4fbac60ad1c4532edd47917a00da0f77d94c75b54f7d?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Amit Kumar Tiwari"},"url":"https:\/\/webkul.com\/blog\/author\/amitkr-tiwari139\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/360510","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/388"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=360510"}],"version-history":[{"count":6,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/360510\/revisions"}],"predecessor-version":[{"id":360537,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/360510\/revisions\/360537"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=360510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=360510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=360510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}