function messaging_template_get_template in Messaging 6.3
Get text part with full data, handling fallbacks
Return value
Full text part object, FALSE if not found
1 call to messaging_template_get_template()
- messaging_template_edit_form in messaging_template/
messaging_template.admin.inc - Edit message formats
File
- messaging_template/
messaging_template.module, line 220 - Template system for Messaging Framework
Code
function messaging_template_get_template($name, $method, $key, $language, $default = TRUE, $fallback = TRUE) {
static $cache;
if (!isset($cache[$language->language][$name][$method])) {
$cache[$language->language][$name][$method] = messaging_template_get_parts($name, $method, $language);
}
$template = FALSE;
if (!isset($cache[$language->language][$name][$method][$key])) {
if ($default) {
// Go for the default method or the default from modules
if ($method_default = messaging_template_method_default($method)) {
$template = messaging_template_get_template($name, $method_default, $key, $language, $default, $fallback);
}
elseif ($defaults = messaging_template_get_defaults($name, $method, $language)) {
$template = isset($defaults[$key]) ? $defaults[$key] : FALSE;
}
}
}
else {
$template = $cache[$language->language][$name][$method][$key];
}
// Still go for the fallback if no template or template is 'fallback'
if ((!$template || $template->options == MESSAGING_STATUS_FALLBACK) && $fallback && ($name_fallback = messaging_template_fallback($name))) {
return messaging_template_get_template($name_fallback, $method, $key, $language, $default, $fallback);
}
else {
return $template;
}
}