You are here

swiftmailer_test.module in Swift Mailer 8

Same filename and directory in other branches
  1. 8.2 tests/modules/swiftmailer_test/swiftmailer_test.module

File

tests/modules/swiftmailer_test/swiftmailer_test.module
View source
<?php

use Drupal\swiftmailer_test\SwiftMailerDrupalStateLogger;

/**
 * Alter messages before sending it with SwiftMailer.
 *
 * @see \Drupal\swiftmailer\Plugin\Mail\SwiftMailer::mail
 */
function swiftmailer_test_swiftmailer_alter(Swift_Mailer &$swiftMailer, Swift_Message &$swiftMessage, &$message) {
  if ($message['module'] === 'swiftmailer_test') {
    $swiftMailer
      ->registerPlugin(new SwiftMailerDrupalStateLogger());
  }
  if ($message['key'] == 'test_1') {
    $swiftMessage
      ->setBody('Replace text in swiftmailer_test_swiftmailer_alter');
  }
}

/**
 * Implements template_preprocess_swiftmailer().
 */
function swiftmailer_test_preprocess_swiftmailer__swiftmailer_test__test_2(&$variables, $hook) {
  $variables['variable_from_preprocess'] = 'variable_from_preprocess';
}

Functions