function htmlmail_theme in HTML Mail 7.2
Same name and namespace in other branches
- 8.3 htmlmail.module \htmlmail_theme()
- 8 htmlmail.module \htmlmail_theme()
- 8.2 htmlmail.module \htmlmail_theme()
- 6.2 htmlmail.module \htmlmail_theme()
- 6 htmlmail.module \htmlmail_theme()
- 7 htmlmail.module \htmlmail_theme()
Implements hook_theme().
Auto-detects htmlmail template files in the selected theme and in the htmlmail module directory.
2 string references to 'htmlmail_theme'
- htmlmail_admin_settings in ./
htmlmail.admin.inc - Form constructor for the admin settings form.
- htmlmail_get_selected_theme in ./
htmlmail.module - Returns the selected theme to use for outgoing emails.
File
- ./
htmlmail.module, line 82 - Sends system emails in HTML.
Code
function htmlmail_theme() {
$items = array();
$module_path = drupal_get_path('module', 'htmlmail');
$pattern = '/^htmlmail.*\\.tpl\\.php$/';
$files = file_scan_directory($module_path, $pattern, array(
'key' => 'name',
));
if ($theme = htmlmail_get_selected_theme()) {
$theme_path = drupal_get_path('theme', $theme);
$files = array_merge($files, file_scan_directory($theme_path, $pattern, array(
'key' => 'name',
)));
}
else {
$theme_path = $module_path;
}
ksort($files);
foreach ($files as $file) {
$path = dirname($file->uri);
$template = substr($file->name, 0, -4);
$suggestion = str_replace('--', '__', $template);
$items[$suggestion] = array(
'variables' => array(
'message' => array(),
),
'template' => $template,
'path' => $path,
'theme path' => $theme_path,
);
}
return $items;
}