function simplenews_test_mail_alter in Simplenews 3.x
Same name and namespace in other branches
- 8.2 tests/modules/simplenews_test/simplenews_test.module \simplenews_test_mail_alter()
- 8 tests/modules/simplenews_test/simplenews_test.module \simplenews_test_mail_alter()
Implements hook_mail_alter().
File
- tests/
modules/ simplenews_test/ simplenews_test.module, line 14 - Hook implementations for the Simplenews Test module.
Code
function simplenews_test_mail_alter(&$message) {
if ($message['id'] == 'simplenews_node') {
/** @var \Drupal\simplenews\Mail\MailInterface $mail */
$mail = $message['params']['simplenews_mail'];
$issue = $mail
->getIssue();
if (!empty($issue->body->value)) {
if ($issue->body->value == 'Nothing interesting') {
throw new SkipMailException('There was nothing interesting to send.');
}
}
}
}