public static function HtmlMailHelper::getAllowedThemes in HTML Mail 8
Same name and namespace in other branches
- 8.3 src/Helper/HtmlMailHelper.php \Drupal\htmlmail\Helper\HtmlMailHelper::getAllowedThemes()
Returns an associative array of allowed themes.
Based on code from the og_theme module.
Return value
array The keys are the machine-readable names and the values are the .info file names.
2 calls to HtmlMailHelper::getAllowedThemes()
- HtmlMailConfigurationForm::buildForm in src/
Form/ HtmlMailConfigurationForm.php - Defines the settings form for HTML Mail.
- HtmlMailHelper::getSelectedTheme in src/
Helper/ HtmlMailHelper.php - Returns the selected theme to use for outgoing emails.
File
- src/
Helper/ HtmlMailHelper.php, line 27
Class
- HtmlMailHelper
- Class HtmlMailHelper.
Namespace
Drupal\htmlmail\HelperCode
public static function getAllowedThemes() {
$allowed =& drupal_static(__FUNCTION__);
if (!isset($allowed)) {
$allowed = [
'' => t('No theme'),
];
$themes = \Drupal::service('theme_handler')
->listInfo();
uasort($themes, 'system_sort_modules_by_info_name');
foreach ($themes as $key => $value) {
if ($value->status) {
$allowed[$key] = Html::escape($value->info['name']);
}
}
}
return $allowed;
}