function messaging_template_message_part in Messaging 6.4
Returns parts of messages, that may be formatted for each sending method
@ TODO Review logic, optimizations, text pre-fetching @ TODO Glue text in a method-dependent way
First checks for message, key, method Then checks for message, key for method 'default' Finally checks default values from modules and hook_messaging()
Parameters
$group: String, specified by the module where the message originates. ie 'subscriptions-event'.
$key: String, key for the desired message part.
$language: Language object
$method: String the mailing method that should be used. OPTIONAL
$getdefault: Boolean, whether to use the default if a specific message isn't available for the used method. OPTIONAL, Defaults to true.
Return value
Assembled text of a message part.
2 calls to messaging_template_message_part()
- messaging_template_admin_message_form in messaging_template/
messaging_template.admin.inc - Edit message formats
- messaging_template_text_part in messaging_template/
messaging_template.module - Get text part with group and method fallback
File
- messaging_template/
messaging_template.module, line 157 - Drupal Messaging Framework - Messaging template
Code
function messaging_template_message_part($group, $key, $method, $language, $getdefault = TRUE) {
$cache =& messaging_static(__FUNCTION__);
$langcode = $language->language;
if (!isset($cache[$langcode][$group][$method])) {
$cache[$langcode][$group][$method] = _messaging_template_message_part($group, $method, $language);
}
if (!$key) {
return $cache[$langcode][$group][$method];
}
if (!isset($cache[$langcode][$group][$method][$key])) {
if ($getdefault && ($fallback = messaging_template_method_fallback($method))) {
// Go for method fallback
$cache[$langcode][$group][$method][$key] = messaging_template_message_part($group, $key, $fallback, $language);
}
else {
// Not found, set a FALSE value in the cache so we don't search again
$cache[$langcode][$group][$method][$key] = FALSE;
}
}
return $cache[$langcode][$group][$method][$key];
}