Skip to content

Instantly share code, notes, and snippets.

@webflo
Created May 27, 2015 14:24
Show Gist options
  • Save webflo/d88e2c83689028f88634 to your computer and use it in GitHub Desktop.
Save webflo/d88e2c83689028f88634 to your computer and use it in GitHub Desktop.
/**
* Implements hook_theme_suggestions_hook_alter().
*/
function foobar_theme_suggestions_swiftmailer_alter(array &$suggestions, array $variables) {
$module_defined = array_key_exists('module', $variables['message']);
$key_defined = array_key_exists('key', $variables['message']);
if($module_defined && $key_defined) {
$suggestions[] = 'swiftmailer__' . $variables['message']['module'];
$suggestions[] = 'swiftmailer__' . $variables['message']['module'] . '__' . $variables['message']['key'];
}
}
{% extends "@my_theme/mail/swiftmailer.html.twig" %}
{% block body %}
<h2>Hallo {{ recipient_name }}!</h2>
<p>{{ sender_name }} ({{ sender_email }}) möchte Ihnen eine Seite im Intranet empfehlen:</p>
<p><a href="{{ page_url }}">{{ page_title }}</a></p>
{% if (message) %}
<p>Darüber hinaus wurde folgende Nachricht hinterlassen:</p>
<p style="font-weight: bold;">{{ message }}</p>
<br />
{% endif %}
<p>Ihr Intranet-Team</p>
{% endblock %}
<?php
/**
* @file
* The default template file for e-mails.
*/
?>
<style type="text/css">
table tr td {
font-family: Arial;
font-size: 12px;
}
</style>
<div>
<table width="800px" cellpadding="0" cellspacing="0">
<tr>
<td>
<div style="padding: 0px 0px 0px 0px;">
{{ body }}
</div>
</td>
</tr>
</table>
<h1>My Awesome E-Mail Footer</h1>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment