rewrited the simplenews template

This commit is contained in:
Bachir Soussi Chiadmi 2021-08-21 21:35:29 +02:00
parent c57f55d810
commit 1c8e810789
1 changed files with 147 additions and 0 deletions

View File

@ -0,0 +1,147 @@
{#
/**
* @file
* Default theme implementation to format the simplenews newsletter body.
*
* Copy this file in your theme directory to create a custom themed body.
* Rename it to override it. Available templates:
* simplenews-newsletter-body--[newsletter_id].html.twig
* simplenews-newsletter-body--[view mode].html.twig
* simplenews-newsletter-body--[newsletter_id]--[view mode].html.twig
* See README.txt for more details.
*
* Available variables:
* - build: Render array. Use {{ build }} to print it.
* - node: object(Drupal\node\Entity\Node)
* The node entity with limited access to object properties and methods.
* * Methods: Only "getter" methods (method names starting with "get", "has", or "is")
* and a few common methods such as "id" and "label" are available.
* {{ node.getTitle }} : the Node title ( == {{ title }} )
* Calling other methods (such as node.delete) will result in an exception.
* * Properties: field values can be accessed as follows:
* {{ node.body.value | raw }} : text of body field
* - newsletter: object(Drupal\simplenews\Entity\Newsletter)
* {{ newsletter.from_name }}: string
* {{ newsletter.subject }}: string
* - title: Node title
* - view_mode: The active display view mode of the node
* - key: email key [node|test]
* - format: newsletter format [plain|html]
* - simplenews_subscriber: object(Drupal\simplenews\Entity\Subscriber)
* The subscriber for which the newsletter is built.
* {{ simplenews_subscriber.getMail }}: string: subscriber's email address
* Note that depending on the used caching strategy, the generated body might
* be used for multiple subscribers. If you created personalized newsletters
* and can't use tokens for that, make sure to disable caching or write a
* custom caching strategy implemention.
*
* @see template_preprocess_simplenews_newsletter_body()
*/
#}
<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="{{ node.getURL }}" 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>
{{ build }}
<table style="margin: 0 0 0 10px; border-collapse: collapse; color: #444444; font-family: arial; font-size: 12px; border-color: #dddddd; background-color: #ffffff;">
<tbody>
<tr>
<td style="vertical-align: top; padding: 5px 0;" width="580">
<table style="border-collapse: collapse; width: 565px; color: #444444; font-family: arial; font-size: 12px; border-color: #dddddd; background-color: #ffffff;" width="565" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding: 5px 0 5px 5px; line-height: normal;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" align="left">
<tbody>
<tr>
<td>
<table style="border-collapse: collapse; align: left;" cellspacing="0" cellpadding="0" align="left">
<tbody>
<tr>
<td style="padding: 2px; margin: 0; vertical-align: top;">
<a href="http://www.facebook.com/sharer.php?u={{ node.getURL }}" target="_blank" style="display: block; border: none; text-decoration: none;">
<img src="http://materio.com/sites/default/files/ico_social_facebook.png" alt="Facebook" style="vertical-align: top; border: none;">
</a>
</td>
<td style="padding: 2px; margin: 0; vertical-align: top;">
<a href="http://twitter.com/share?url={{ node.getURL }}" target="_blank" style="display: block; border: none; text-decoration: none;">
<img src="http://materio.com/sites/default/files/ico_social_twitter.png" alt="Twitter" style="vertical-align: top; border: none;">
</a>
</td>
<td style="padding: 2px; margin: 0; vertical-align: top;">
<a href="http://www.linkedin.com/shareArticle?url={{ node.getURL }}" target="_blank" style="display: block; border: none; text-decoration: none;">
<img src="http://materio.com/sites/default/files/ico_social_linkedin.png" alt="Linkedin" style="vertical-align: top; border: none;">
</a>
</td>
<td style="padding: 2px; margin: 0; vertical-align: top;">
<a href="http://pinterest.com/hello0691/ze-daily-mat%C3%A9rio/" target="_blank" style="display: block; border: none; text-decoration: none;">
<img src="http://materio.com/sites/default/files/ico_social_pinterest.png" alt="Pinterest" style="vertical-align: top; border: none;">
</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table style="height: 10px; border-collapse: collapse; font-size: 1px;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="height: 10px; border-spacing: 0; font-size: 1px;" height="10">
&nbsp;
</td>
</tr>
</tbody>
</table>
{% if not opt_out_hidden %}
{% if format == 'html' %}
<p class="newsletter-footer"><a
href="[simplenews-subscriber:unsubscribe-url]">{{ unsubscribe_text }}</a>
</p>
{% else %}
-- {{ unsubscribe_text }} : [simplenews-subscriber:unsubscribe-url]
{% endif %}
{% endif %}
{% if key == 'test' %}
- - - {{ test_message }} - - -
{% endif %}
<p id="footer_address" style="color:#444444; text-align: center; margin: 20px 20px 0; line-height:0.7; font-size:10px; ">
matériO SAS<br>8, rue Chaptal<br>75009 Paris<br><a href="www.materio.com" style="color:#444444">www.materio.com</a>
</p>
</td>
</tr>
</tbody>
</table>