Преглед на файлове

fixed readonline linnk in simplenews template

bach преди 2 години
родител
ревизия
62879244e1

+ 17 - 0
web/themes/custom/materiotheme/materiotheme.theme

@@ -187,6 +187,23 @@ function materiotheme_preprocess_page(&$vars){
 
 }
 
+
+/**
+ * Prepares variables for email template.
+ *
+ * Default template: email.html.twig.
+ *
+ * @param array $variables
+ *   An associative array containing:
+ *   - email: An associative array containing the Email object.
+ */
+function materiotheme_preprocess_email(&$variables) {
+  $email = $variables['email'];
+  $variables['body'] = $email->getBody();
+  $variables = array_merge($variables, $email->getVariables());
+}
+
+
 // function materiotheme_preprocess_node(&$vars){
 //   $node = $vars['elements']['#node'];
 //   $options = ['absolute' => TRUE];

+ 5 - 3
web/themes/custom/materiotheme/templates/email--simplenews-newsletter.html.twig

@@ -1,16 +1,18 @@
-
+{# dump() #}
+{# devel_breakpoint() #}
+{# dump(_context|keys) #}
+{# dump(content_attributes) #}
 <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
   <tbody>
     <tr>
       <td style="padding: 37px 0; background-color: #eeeeee; text-align:center;" align="center" bgcolor="#eeeeee">
         <!-- #nl_container -->
-        <p style="text-align:center; margin:5px 0;"><a href="#" style="font-size:9px; color:#444444;">Voir la version en ligne / View this email on the web</a>
+        <p style="text-align:center; margin:5px 0;"><a href="[node:url]" style="font-size:9px; color:#444444;">Voir la version en ligne / View this email on the web</a>
         <table bgcolor="#ffffff" style="margin: 0 auto; color: #444444; font-family: arial; font-size: 12px; background-color: #ffffff; float:none; position:relative;" width="600" border="0" cellspacing="0" cellpadding="0">
           <tbody>
             <tr>
               <td style="text-align:left;">
 
-                {# <h2>{{ title }}</h2> #}
                 {{ body }}
 
                 <table style="margin: 0 0 0 10px; border-collapse: collapse; color: #444444; font-family: arial; font-size: 12px; border-color: #dddddd; background-color: #ffffff;">