public static function HtmlMailHelper::getSelectedTheme in HTML Mail 8
Same name and namespace in other branches
- 8.3 src/Helper/HtmlMailHelper.php \Drupal\htmlmail\Helper\HtmlMailHelper::getSelectedTheme()
Returns the selected theme to use for outgoing emails.
Parameters
array $message: (optional) The message to be themed.
Return value
string The 'theme' key of $message if set and allowed, empty string otherwise.
3 calls to HtmlMailHelper::getSelectedTheme()
- HTMLMailSystem::format in src/
Plugin/ Mail/ HTMLMailSystem.php - Format emails according to module settings.
- htmlmail_theme in ./
htmlmail.module - Implements hook_theme().
- template_preprocess_htmlmail in ./
htmlmail.module - Process variables to format email messages.
File
- src/
Helper/ HtmlMailHelper.php, line 72
Class
- HtmlMailHelper
- Class HtmlMailHelper.
Namespace
Drupal\htmlmail\HelperCode
public static function getSelectedTheme(array &$message = []) {
$selected = isset($message['theme']) ? $message['theme'] : \Drupal::config('htmlmail.settings')
->get('htmlmail_theme');
if ($selected) {
// Make sure the selected theme is allowed.
$themes = self::getAllowedThemes();
if (empty($themes[$selected])) {
$selected = '';
}
}
return $selected;
}