postoffice-1.0.x-dev/extensions/postoffice_compat_theme/tests/modules/hook_test/postoffice_compat_theme_hook_test.module
extensions/postoffice_compat_theme/tests/modules/hook_test/postoffice_compat_theme_hook_test.module
<?php
/**
* @file
* Primary module hooks for Postoffice Compat Fallback Test module.
*/
use Drupal\Component\Render\FormattableMarkup;
/**
* Implements hook_mail().
*/
function postoffice_compat_theme_hook_test_mail($key, &$message, $params) {
$element = [
'#markup' => new FormattableMarkup('The currently active theme is: @theme', [
'@theme' => \Drupal::theme()->getActiveTheme()->getName(),
]),
];
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::service('renderer');
$message['body'][] = $renderer->renderInIsolation($element);
$message['subject'] = 'Current active theme';
}
